Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: src/counters.h

Issue 23729006: thread isolate for files starting with 'b' and 'c' (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: remaining arches Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/contexts.cc ('k') | src/counters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // the StatsTable. They are designed to be lightweight to create and 109 // the StatsTable. They are designed to be lightweight to create and
110 // easy to use. 110 // easy to use.
111 // 111 //
112 // Internally, a counter represents a value in a row of a StatsTable. 112 // Internally, a counter represents a value in a row of a StatsTable.
113 // The row has a 32bit value for each process/thread in the table and also 113 // The row has a 32bit value for each process/thread in the table and also
114 // a name (stored in the table metadata). Since the storage location can be 114 // a name (stored in the table metadata). Since the storage location can be
115 // thread-specific, this class cannot be shared across threads. 115 // thread-specific, this class cannot be shared across threads.
116 class StatsCounter { 116 class StatsCounter {
117 public: 117 public:
118 StatsCounter() { } 118 StatsCounter() { }
119 explicit StatsCounter(const char* name) 119 explicit StatsCounter(Isolate* isolate, const char* name)
120 : name_(name), ptr_(NULL), lookup_done_(false) { } 120 : isolate_(isolate), name_(name), ptr_(NULL), lookup_done_(false) { }
121 121
122 // Sets the counter to a specific value. 122 // Sets the counter to a specific value.
123 void Set(int value) { 123 void Set(int value) {
124 int* loc = GetPtr(); 124 int* loc = GetPtr();
125 if (loc) *loc = value; 125 if (loc) *loc = value;
126 } 126 }
127 127
128 // Increments the counter. 128 // Increments the counter.
129 void Increment() { 129 void Increment() {
130 int* loc = GetPtr(); 130 int* loc = GetPtr();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 int* GetPtr() { 168 int* GetPtr() {
169 if (lookup_done_) return ptr_; 169 if (lookup_done_) return ptr_;
170 lookup_done_ = true; 170 lookup_done_ = true;
171 ptr_ = FindLocationInStatsTable(); 171 ptr_ = FindLocationInStatsTable();
172 return ptr_; 172 return ptr_;
173 } 173 }
174 174
175 private: 175 private:
176 int* FindLocationInStatsTable() const; 176 int* FindLocationInStatsTable() const;
177 177
178 Isolate* isolate_;
178 const char* name_; 179 const char* name_;
179 int* ptr_; 180 int* ptr_;
180 bool lookup_done_; 181 bool lookup_done_;
181 }; 182 };
182 183
183 // A Histogram represents a dynamically created histogram in the StatsTable. 184 // A Histogram represents a dynamically created histogram in the StatsTable.
184 // It will be registered with the histogram system on first use. 185 // It will be registered with the histogram system on first use.
185 class Histogram { 186 class Histogram {
186 public: 187 public:
187 Histogram() { } 188 Histogram() { }
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 timer_->Stop(); 274 timer_->Stop();
274 } 275 }
275 private: 276 private:
276 HistogramTimer* timer_; 277 HistogramTimer* timer_;
277 }; 278 };
278 279
279 280
280 } } // namespace v8::internal 281 } } // namespace v8::internal
281 282
282 #endif // V8_COUNTERS_H_ 283 #endif // V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « src/contexts.cc ('k') | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698