OLD | NEW |
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 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1055 | 1055 |
1056 v8::Script::Compile(v8::String::New(call_function_test_source))->Run(); | 1056 v8::Script::Compile(v8::String::New(call_function_test_source))->Run(); |
1057 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( | 1057 v8::Local<v8::Function> function = v8::Local<v8::Function>::Cast( |
1058 env->Global()->Get(v8::String::New("start"))); | 1058 env->Global()->Get(v8::String::New("start"))); |
1059 | 1059 |
1060 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); | 1060 v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler(); |
1061 v8::Local<v8::String> profile_name = v8::String::New("my_profile"); | 1061 v8::Local<v8::String> profile_name = v8::String::New("my_profile"); |
1062 | 1062 |
1063 cpu_profiler->StartCpuProfiling(profile_name); | 1063 cpu_profiler->StartCpuProfiling(profile_name); |
1064 int32_t duration_ms = 100; | 1064 int32_t duration_ms = 100; |
| 1065 #if defined(_WIN32) || defined(_WIN64) |
| 1066 // 100ms is not enough on Windows. See |
| 1067 // https://code.google.com/p/v8/issues/detail?id=2628 |
| 1068 duration_ms = 400; |
| 1069 #endif |
1065 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; | 1070 v8::Handle<v8::Value> args[] = { v8::Integer::New(duration_ms) }; |
1066 function->Call(env->Global(), ARRAY_SIZE(args), args); | 1071 function->Call(env->Global(), ARRAY_SIZE(args), args); |
1067 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name); | 1072 const v8::CpuProfile* profile = cpu_profiler->StopCpuProfiling(profile_name); |
1068 | 1073 |
1069 CHECK_NE(NULL, profile); | 1074 CHECK_NE(NULL, profile); |
1070 // Dump collected profile to have a better diagnostic in case of failure. | 1075 // Dump collected profile to have a better diagnostic in case of failure. |
1071 reinterpret_cast<i::CpuProfile*>( | 1076 reinterpret_cast<i::CpuProfile*>( |
1072 const_cast<v8::CpuProfile*>(profile))->Print(); | 1077 const_cast<v8::CpuProfile*>(profile))->Print(); |
1073 | 1078 |
1074 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); | 1079 const v8::CpuProfileNode* root = profile->GetTopDownRoot(); |
(...skipping 18 matching lines...) Expand all Loading... |
1093 FindChild(root, i::ProfileGenerator::kUnresolvedFunctionName); | 1098 FindChild(root, i::ProfileGenerator::kUnresolvedFunctionName); |
1094 if (unresolvedNode) { | 1099 if (unresolvedNode) { |
1095 ScopedVector<v8::Handle<v8::String> > names(1); | 1100 ScopedVector<v8::Handle<v8::String> > names(1); |
1096 names[0] = v8::String::New("call"); | 1101 names[0] = v8::String::New("call"); |
1097 CheckChildrenNames(unresolvedNode, names); | 1102 CheckChildrenNames(unresolvedNode, names); |
1098 } | 1103 } |
1099 | 1104 |
1100 cpu_profiler->DeleteAllCpuProfiles(); | 1105 cpu_profiler->DeleteAllCpuProfiles(); |
1101 } | 1106 } |
1102 | 1107 |
OLD | NEW |