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

Side by Side Diff: src/api.cc

Issue 259803002: Add timestamps to CPU profile samples. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix race Created 6 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 | Annotate | Revision Log
« no previous file with comments | « include/v8-profiler.h ('k') | src/cpu-profiler.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 7049 matching lines...) Expand 10 before | Expand all | Expand 10 after
7060 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root()); 7060 return reinterpret_cast<const CpuProfileNode*>(profile->top_down()->root());
7061 } 7061 }
7062 7062
7063 7063
7064 const CpuProfileNode* CpuProfile::GetSample(int index) const { 7064 const CpuProfileNode* CpuProfile::GetSample(int index) const {
7065 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 7065 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7066 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index)); 7066 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index));
7067 } 7067 }
7068 7068
7069 7069
7070 int64_t CpuProfile::GetSampleTimestamp(int index) const {
7071 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7072 return (profile->sample_timestamp(index) - i::TimeTicks()).InMicroseconds();
7073 }
7074
7075
7070 int64_t CpuProfile::GetStartTime() const { 7076 int64_t CpuProfile::GetStartTime() const {
7071 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 7077 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7072 return (profile->start_time() - i::TimeTicks()).InMicroseconds(); 7078 return (profile->start_time() - i::TimeTicks()).InMicroseconds();
7073 } 7079 }
7074 7080
7075 7081
7076 int64_t CpuProfile::GetEndTime() const { 7082 int64_t CpuProfile::GetEndTime() const {
7077 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 7083 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7078 return (profile->end_time() - i::TimeTicks()).InMicroseconds(); 7084 return (profile->end_time() - i::TimeTicks()).InMicroseconds();
7079 } 7085 }
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
7598 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7604 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7599 Address callback_address = 7605 Address callback_address =
7600 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7606 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7601 VMState<EXTERNAL> state(isolate); 7607 VMState<EXTERNAL> state(isolate);
7602 ExternalCallbackScope call_scope(isolate, callback_address); 7608 ExternalCallbackScope call_scope(isolate, callback_address);
7603 callback(info); 7609 callback(info);
7604 } 7610 }
7605 7611
7606 7612
7607 } } // namespace v8::internal 7613 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | src/cpu-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698