| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/at_exit.h" |
| 6 #include "base/command_line.h" |
| 7 #include "base/debug_util.h" |
| 5 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 6 #include "base/perftimer.h" | 9 #include "base/perftimer.h" |
| 7 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 8 #include "chrome/common/chrome_paths.cc" | 11 #include "chrome/common/chrome_paths.cc" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 13 |
| 11 // TODO(darin): share code with base/run_all_perftests.cc | 14 // TODO(darin): share code with base/run_all_perftests.cc |
| 12 | 15 |
| 13 int main(int argc, char **argv) { | 16 int main(int argc, char **argv) { |
| 17 base::AtExitManager exit_manager; |
| 14 base::EnableTerminationOnHeapCorruption(); | 18 base::EnableTerminationOnHeapCorruption(); |
| 19 CommandLine::SetArgcArgv(argc, argv); |
| 15 chrome::RegisterPathProvider(); | 20 chrome::RegisterPathProvider(); |
| 16 MessageLoop main_message_loop; | 21 MessageLoop main_message_loop; |
| 17 | 22 |
| 18 testing::InitGoogleTest(&argc, argv); | 23 testing::InitGoogleTest(&argc, argv); |
| 19 | 24 |
| 20 const char log_file_switch[] = "-o"; | 25 const char log_file_switch[] = "-o"; |
| 21 const char* log_filename = NULL; | 26 const char* log_filename = NULL; |
| 22 for (int i = 1; i < argc; i++) { | 27 for (int i = 1; i < argc; i++) { |
| 23 if (strcmp(argv[i], log_file_switch) == 0) { | 28 if (strcmp(argv[i], log_file_switch) == 0) { |
| 24 // found the switch for the log file, use the next arg | 29 // found the switch for the log file, use the next arg |
| (...skipping 11 matching lines...) Expand all Loading... |
| 36 printf("Using output file \"%s\" (change with %s <filename>)\n", | 41 printf("Using output file \"%s\" (change with %s <filename>)\n", |
| 37 log_filename, log_file_switch); | 42 log_filename, log_file_switch); |
| 38 | 43 |
| 39 if (!InitPerfLog(log_filename)) { | 44 if (!InitPerfLog(log_filename)) { |
| 40 fprintf(stderr, "Unable to open log file\n"); | 45 fprintf(stderr, "Unable to open log file\n"); |
| 41 return 1; | 46 return 1; |
| 42 } | 47 } |
| 43 | 48 |
| 44 // Raise to high priority to have more precise measurements. Since we don't | 49 // Raise to high priority to have more precise measurements. Since we don't |
| 45 // aim at 1% precision, it is not necessary to run at realtime level. | 50 // aim at 1% precision, it is not necessary to run at realtime level. |
| 46 if (!IsDebuggerPresent()) { | 51 if (!DebugUtil::BeingDebugged()) { |
| 47 SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS); | 52 base::RaiseProcessToHighPriority(); |
| 48 } | 53 } |
| 49 | 54 |
| 50 int result = RUN_ALL_TESTS(); | 55 int result = RUN_ALL_TESTS(); |
| 51 | 56 |
| 52 FinalizePerfLog(); | 57 FinalizePerfLog(); |
| 53 return result; | 58 return result; |
| 54 } | 59 } |
| 55 | 60 |
| OLD | NEW |