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

Side by Side Diff: src/api.cc

Issue 23295034: Add Chromium-style TimeDelta, Time and TimeTicks classes, and a new ElapsedTimer class. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix windows build. 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
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 7630 matching lines...) Expand 10 before | Expand all | Expand 10 after
7641 7641
7642 7642
7643 const CpuProfileNode* CpuProfile::GetSample(int index) const { 7643 const CpuProfileNode* CpuProfile::GetSample(int index) const {
7644 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 7644 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7645 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index)); 7645 return reinterpret_cast<const CpuProfileNode*>(profile->sample(index));
7646 } 7646 }
7647 7647
7648 7648
7649 int64_t CpuProfile::GetStartTime() const { 7649 int64_t CpuProfile::GetStartTime() const {
7650 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 7650 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7651 return profile->start_time_us(); 7651 return (profile->start_time() - i::Time::UnixEpoch()).InMicroseconds();
7652 } 7652 }
7653 7653
7654 7654
7655 int64_t CpuProfile::GetEndTime() const { 7655 int64_t CpuProfile::GetEndTime() const {
7656 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this); 7656 const i::CpuProfile* profile = reinterpret_cast<const i::CpuProfile*>(this);
7657 return profile->end_time_us(); 7657 return (profile->end_time() - i::Time::UnixEpoch()).InMicroseconds();
7658 } 7658 }
7659 7659
7660 7660
7661 int CpuProfile::GetSamplesCount() const { 7661 int CpuProfile::GetSamplesCount() const {
7662 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count(); 7662 return reinterpret_cast<const i::CpuProfile*>(this)->samples_count();
7663 } 7663 }
7664 7664
7665 7665
7666 int CpuProfiler::GetProfileCount() { 7666 int CpuProfiler::GetProfileCount() {
7667 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount(); 7667 return reinterpret_cast<i::CpuProfiler*>(this)->GetProfilesCount();
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
8228 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8228 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8229 Address callback_address = 8229 Address callback_address =
8230 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8230 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8231 VMState<EXTERNAL> state(isolate); 8231 VMState<EXTERNAL> state(isolate);
8232 ExternalCallbackScope call_scope(isolate, callback_address); 8232 ExternalCallbackScope call_scope(isolate, callback_address);
8233 return callback(info); 8233 return callback(info);
8234 } 8234 }
8235 8235
8236 8236
8237 } } // namespace v8::internal 8237 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8config.h ('k') | src/compiler.h » ('j') | src/time/elapsed-timer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698