blob: c0b91c187ae7633567b8b54bfdcf71e9337da9cc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/debug_util.h"
#include "base/perftimer.h"
#include "base/process_util.h"
#include "base/string_util.h"
#include "base/test_suite.h"
class PerfTestSuite : public TestSuite {
public:
PerfTestSuite(int argc, char** argv) : TestSuite(argc, argv) {
}
virtual void Initialize() {
// Initialize the perf timer log
std::string log_file =
WideToUTF8(CommandLine().GetSwitchValue(L"log-file"));
if (log_file.empty())
log_file = "perf_test.log";
ASSERT_TRUE(InitPerfLog(log_file.c_str()));
// Raise to high priority to have more precise measurements. Since we don't
// aim at 1% precision, it is not necessary to run at realtime level.
if (!DebugUtil::BeingDebugged())
base::RaiseProcessToHighPriority();
TestSuite::Initialize();
}
virtual void Shutdown() {
TestSuite::Shutdown();
FinalizePerfLog();
}
};
int main(int argc, char** argv) {
return PerfTestSuite(argc, argv).Run();
}
|