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

Side by Side Diff: test/cctest/test-profile-generator.cc

Issue 13460002: Isolatify CPU profiler public API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase Created 7 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 | « test/cctest/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling); 823 return v8::FunctionTemplate::New(ProfilerExtension::StopProfiling);
824 } else { 824 } else {
825 CHECK(false); 825 CHECK(false);
826 return v8::Handle<v8::FunctionTemplate>(); 826 return v8::Handle<v8::FunctionTemplate>();
827 } 827 }
828 } 828 }
829 829
830 830
831 v8::Handle<v8::Value> ProfilerExtension::StartProfiling( 831 v8::Handle<v8::Value> ProfilerExtension::StartProfiling(
832 const v8::Arguments& args) { 832 const v8::Arguments& args) {
833 v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
833 if (args.Length() > 0) 834 if (args.Length() > 0)
834 v8::CpuProfiler::StartProfiling(args[0].As<v8::String>()); 835 cpu_profiler->StartCpuProfiling(args[0].As<v8::String>());
835 else 836 else
836 v8::CpuProfiler::StartProfiling(v8::String::New("")); 837 cpu_profiler->StartCpuProfiling(v8::String::New(""));
837 return v8::Undefined(); 838 return v8::Undefined();
838 } 839 }
839 840
840 841
841 v8::Handle<v8::Value> ProfilerExtension::StopProfiling( 842 v8::Handle<v8::Value> ProfilerExtension::StopProfiling(
842 const v8::Arguments& args) { 843 const v8::Arguments& args) {
844 v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
843 if (args.Length() > 0) 845 if (args.Length() > 0)
844 v8::CpuProfiler::StopProfiling(args[0].As<v8::String>()); 846 cpu_profiler->StopCpuProfiling(args[0].As<v8::String>());
845 else 847 else
846 v8::CpuProfiler::StopProfiling(v8::String::New("")); 848 cpu_profiler->StopCpuProfiling(v8::String::New(""));
847 return v8::Undefined(); 849 return v8::Undefined();
848 } 850 }
849 851
850 852
851 static ProfilerExtension kProfilerExtension; 853 static ProfilerExtension kProfilerExtension;
852 v8::DeclareExtension kProfilerExtensionDeclaration(&kProfilerExtension); 854 v8::DeclareExtension kProfilerExtensionDeclaration(&kProfilerExtension);
853 static v8::Persistent<v8::Context> env; 855 static v8::Persistent<v8::Context> env;
854 856
855 static const ProfileNode* PickChild(const ProfileNode* parent, 857 static const ProfileNode* PickChild(const ProfileNode* parent,
856 const char* name) { 858 const char* name) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 i::OS::SNPrintF(title, "%d", i); 926 i::OS::SNPrintF(title, "%d", i);
925 // UID must be > 0. 927 // UID must be > 0.
926 CHECK(collection.StartProfiling(title.start(), i + 1, false)); 928 CHECK(collection.StartProfiling(title.start(), i + 1, false));
927 titles[i] = title.start(); 929 titles[i] = title.start();
928 } 930 }
929 CHECK(!collection.StartProfiling( 931 CHECK(!collection.StartProfiling(
930 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false)); 932 "maximum", CpuProfilesCollection::kMaxSimultaneousProfiles + 1, false));
931 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i) 933 for (int i = 0; i < CpuProfilesCollection::kMaxSimultaneousProfiles; ++i)
932 i::DeleteArray(titles[i]); 934 i::DeleteArray(titles[i]);
933 } 935 }
OLDNEW
« no previous file with comments | « test/cctest/test-cpu-profiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698