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

Side by Side Diff: src/cpu-profiler.h

Issue 1635005: Allow new CPU profiling subsystem to coexist nicely with the old one. (Closed)
Patch Set: Fix TickSampleEvent Created 10 years, 8 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 public: 96 public:
97 Address alias; 97 Address alias;
98 Address start; 98 Address start;
99 99
100 INLINE(void UpdateCodeMap(CodeMap* code_map)); 100 INLINE(void UpdateCodeMap(CodeMap* code_map));
101 }; 101 };
102 102
103 103
104 class TickSampleEventRecord BASE_EMBEDDED { 104 class TickSampleEventRecord BASE_EMBEDDED {
105 public: 105 public:
106 // In memory, the first machine word of a TickSampleEventRecord will be the 106 // The first machine word of a TickSampleEventRecord must not ever
107 // first entry of TickSample, that is -- the VM state field. 107 // become equal to SamplingCircularQueue::kClear. As both order and
108 // TickSample is put first, because 'order' can become equal to 108 // TickSample's first field are not reliable in this sense (order
109 // SamplingCircularQueue::kClear, while VM state can't, see 109 // can overflow, TickSample can have all fields reset), we are
110 // the definition of 'enum StateTag'. 110 // forced to use an artificial filler field.
111 int filler;
112 unsigned order;
111 TickSample sample; 113 TickSample sample;
112 unsigned order;
113 114
114 static TickSampleEventRecord* cast(void* value) { 115 static TickSampleEventRecord* cast(void* value) {
115 return reinterpret_cast<TickSampleEventRecord*>(value); 116 return reinterpret_cast<TickSampleEventRecord*>(value);
116 } 117 }
117 118
119 INLINE(static TickSampleEventRecord* init(void* value));
120
118 private: 121 private:
119 DISALLOW_IMPLICIT_CONSTRUCTORS(TickSampleEventRecord); 122 DISALLOW_IMPLICIT_CONSTRUCTORS(TickSampleEventRecord);
120 }; 123 };
121 124
122 125
123 // This class implements both the profile events processor thread and 126 // This class implements both the profile events processor thread and
124 // methods called by event producers: VM and stack sampler threads. 127 // methods called by event producers: VM and stack sampler threads.
125 class ProfilerEventsProcessor : public Thread { 128 class ProfilerEventsProcessor : public Thread {
126 public: 129 public:
127 explicit ProfilerEventsProcessor(ProfileGenerator* generator); 130 explicit ProfilerEventsProcessor(ProfileGenerator* generator);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 void StartCollectingProfile(String* title); 252 void StartCollectingProfile(String* title);
250 void StartProcessorIfNotStarted(); 253 void StartProcessorIfNotStarted();
251 CpuProfile* StopCollectingProfile(const char* title); 254 CpuProfile* StopCollectingProfile(const char* title);
252 CpuProfile* StopCollectingProfile(String* title); 255 CpuProfile* StopCollectingProfile(String* title);
253 void StopProcessorIfLastProfile(); 256 void StopProcessorIfLastProfile();
254 257
255 CpuProfilesCollection* profiles_; 258 CpuProfilesCollection* profiles_;
256 unsigned next_profile_uid_; 259 unsigned next_profile_uid_;
257 ProfileGenerator* generator_; 260 ProfileGenerator* generator_;
258 ProfilerEventsProcessor* processor_; 261 ProfilerEventsProcessor* processor_;
262 int saved_logging_nesting_;
259 263
260 static CpuProfiler* singleton_; 264 static CpuProfiler* singleton_;
261 265
262 #else 266 #else
263 static INLINE(bool is_profiling()) { return false; } 267 static INLINE(bool is_profiling()) { return false; }
264 #endif // ENABLE_CPP_PROFILES_PROCESSOR 268 #endif // ENABLE_CPP_PROFILES_PROCESSOR
265 269
266 private: 270 private:
267 DISALLOW_COPY_AND_ASSIGN(CpuProfiler); 271 DISALLOW_COPY_AND_ASSIGN(CpuProfiler);
268 }; 272 };
269 273
270 } } // namespace v8::internal 274 } } // namespace v8::internal
271 275
272 276
273 #endif // V8_CPU_PROFILER_H_ 277 #endif // V8_CPU_PROFILER_H_
OLDNEW
« no previous file with comments | « SConstruct ('k') | src/cpu-profiler.cc » ('j') | src/cpu-profiler-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698