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

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

Issue 2105943002: Expose TickSample and its APIs in v8-profiler.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_PROFILER_CPU_PROFILER_INL_H_ 5 #ifndef V8_PROFILER_CPU_PROFILER_INL_H_
6 #define V8_PROFILER_CPU_PROFILER_INL_H_ 6 #define V8_PROFILER_CPU_PROFILER_INL_H_
7 7
8 #include "src/profiler/cpu-profiler.h" 8 #include "src/profiler/cpu-profiler.h"
9 9
10 #include <new> 10 #include <new>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 TickSample* ProfilerEventsProcessor::StartTickSample() { 64 TickSample* ProfilerEventsProcessor::StartTickSample() {
65 void* address = ticks_buffer_.StartEnqueue(); 65 void* address = ticks_buffer_.StartEnqueue();
66 if (address == NULL) return NULL; 66 if (address == NULL) return NULL;
67 TickSampleEventRecord* evt = 67 TickSampleEventRecord* evt =
68 new (address) TickSampleEventRecord(last_code_event_id_.Value()); 68 new (address) TickSampleEventRecord(last_code_event_id_.Value());
69 return &evt->sample; 69 return &evt->sample;
70 } 70 }
71 71
72 72
73 void ProfilerEventsProcessor::FinishTickSample() { 73 void ProfilerEventsProcessor::FinishTickSample() {
74 TickSampleEventRecord* evt = ticks_buffer_.CurrentEnqueue();
75 evt->timestamp = evt->sample.pc == nullptr
76 ? base::TimeTicks()
77 : base::TimeTicks::HighResolutionNow();
74 ticks_buffer_.FinishEnqueue(); 78 ticks_buffer_.FinishEnqueue();
75 } 79 }
76 80
77 } // namespace internal 81 } // namespace internal
78 } // namespace v8 82 } // namespace v8
79 83
80 #endif // V8_PROFILER_CPU_PROFILER_INL_H_ 84 #endif // V8_PROFILER_CPU_PROFILER_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698