blob: 4f31e553f2dcf43983261ce918764a36d98ad89e [file] [log] [blame]
license.botf003cfe2008-08-24 09:55:55 +09001// 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
3// found in the LICENSE file.
initial.commit3f4a7322008-07-27 06:49:38 +09004
5#include <stdio.h>
6#include <shlwapi.h>
7#include <windows.h>
8
9#include "base/perftimer.h"
10
11#include "base/logging.h"
12#include "base/basictypes.h"
13
14static FILE* perf_log_file = NULL;
15
16bool InitPerfLog(const char* log_file) {
17 if (perf_log_file) {
18 // trying to initialize twice
19 NOTREACHED();
20 return false;
21 }
22
23 return fopen_s(&perf_log_file, log_file, "w") == 0;
24}
25
26void FinalizePerfLog() {
27 if (!perf_log_file) {
28 // trying to cleanup without initializing
29 NOTREACHED();
30 return;
31 }
32 fclose(perf_log_file);
33}
34
35void LogPerfResult(const char* test_name, double value, const char* units) {
36 if (!perf_log_file) {
37 NOTREACHED();
38 return;
39 }
40
41 fprintf(perf_log_file, "%s\t%g\t%s\n", test_name, value, units);
42 printf("%s\t%g\t%s\n", test_name, value, units);
43}
44
license.botf003cfe2008-08-24 09:55:55 +090045