blob: 93d1932f0423607150c722cf1c1efea1a2a81876 (
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
|
// Copyright (c) 2012 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 "chrome/browser/gpu_performance_stats.h"
#include "base/stringprintf.h"
namespace {
DictionaryValue* NewDescriptionValuePairFromFloat(const std::string& desc,
float value) {
DictionaryValue* dict = new DictionaryValue();
dict->SetString("description", desc);
dict->SetString("value", base::StringPrintf("%.1f", value));
return dict;
}
} // namespace
#if !defined(OS_WIN)
// No data for other operating systems yet, just return 0.0s.
GpuPerformanceStats GpuPerformanceStats::RetrieveGpuPerformanceStats() {
return GpuPerformanceStats();
}
#endif
base::Value* GpuPerformanceStats::ToValue() const {
ListValue* result = new ListValue();
result->Append(NewDescriptionValuePairFromFloat("Graphics", graphics));
result->Append(NewDescriptionValuePairFromFloat("Gaming", gaming));
result->Append(NewDescriptionValuePairFromFloat("Overall", overall));
return result;
}
|