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

Side by Side Diff: src/api.cc

Issue 22412003: Support idle time in CPU profiler (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment addressed Created 7 years, 4 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.h » ('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 7628 matching lines...) Expand 10 before | Expand all | Expand 10 after
7639 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling( 7639 reinterpret_cast<i::CpuProfiler*>(this)->StopProfiling(
7640 *Utils::OpenHandle(*title))); 7640 *Utils::OpenHandle(*title)));
7641 } 7641 }
7642 7642
7643 7643
7644 void CpuProfiler::DeleteAllCpuProfiles() { 7644 void CpuProfiler::DeleteAllCpuProfiles() {
7645 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles(); 7645 reinterpret_cast<i::CpuProfiler*>(this)->DeleteAllProfiles();
7646 } 7646 }
7647 7647
7648 7648
7649 void CpuProfiler::SetIdle(bool is_idle) {
7650 i::Isolate* isolate = reinterpret_cast<i::CpuProfiler*>(this)->isolate();
7651 i::StateTag state = isolate->current_vm_state();
7652 ASSERT(state == i::EXTERNAL || state == i::IDLE);
7653 if (isolate->js_entry_sp() != NULL) return;
7654 if (is_idle) {
7655 isolate->set_current_vm_state(i::IDLE);
7656 } else if (state == i::IDLE) {
7657 isolate->set_current_vm_state(i::EXTERNAL);
7658 }
7659 }
7660
7661
7649 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) { 7662 static i::HeapGraphEdge* ToInternal(const HeapGraphEdge* edge) {
7650 return const_cast<i::HeapGraphEdge*>( 7663 return const_cast<i::HeapGraphEdge*>(
7651 reinterpret_cast<const i::HeapGraphEdge*>(edge)); 7664 reinterpret_cast<const i::HeapGraphEdge*>(edge));
7652 } 7665 }
7653 7666
7654 7667
7655 HeapGraphEdge::Type HeapGraphEdge::GetType() const { 7668 HeapGraphEdge::Type HeapGraphEdge::GetType() const {
7656 i::Isolate* isolate = i::Isolate::Current(); 7669 i::Isolate* isolate = i::Isolate::Current();
7657 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType"); 7670 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetType");
7658 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type()); 7671 return static_cast<HeapGraphEdge::Type>(ToInternal(this)->type());
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
8169 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8182 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8170 Address callback_address = 8183 Address callback_address =
8171 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8184 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8172 VMState<EXTERNAL> state(isolate); 8185 VMState<EXTERNAL> state(isolate);
8173 ExternalCallbackScope call_scope(isolate, callback_address); 8186 ExternalCallbackScope call_scope(isolate, callback_address);
8174 return callback(info); 8187 return callback(info);
8175 } 8188 }
8176 8189
8177 8190
8178 } } // namespace v8::internal 8191 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8-profiler.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698