diff options
author | dominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 15:40:31 +0000 |
---|---|---|
committer | dominich@chromium.org <dominich@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-09 15:40:31 +0000 |
commit | 53dcc5cb1f0a7657590b16b1e171dc34ec01959b (patch) | |
tree | cc69c6912529b726257f29f2f4bb0f40bf4a2959 /content | |
parent | 5b4926e1893925ce5be80d1e43fe753f27952e9c (diff) | |
download | chromium_src-53dcc5cb1f0a7657590b16b1e171dc34ec01959b.zip chromium_src-53dcc5cb1f0a7657590b16b1e171dc34ec01959b.tar.gz chromium_src-53dcc5cb1f0a7657590b16b1e171dc34ec01959b.tar.bz2 |
Moving the contents of chrome://gpu Profiling to chrome://tracing.
BUG=91406
TEST=none
Review URL: http://codereview.chromium.org/7555005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95998 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/gpu/gpu_data_manager.cc | 84 | ||||
-rw-r--r-- | content/browser/gpu/gpu_data_manager.h | 3 |
2 files changed, 87 insertions, 0 deletions
diff --git a/content/browser/gpu/gpu_data_manager.cc b/content/browser/gpu/gpu_data_manager.cc index 079191a..779ca26 100644 --- a/content/browser/gpu/gpu_data_manager.cc +++ b/content/browser/gpu/gpu_data_manager.cc @@ -40,6 +40,45 @@ void DisplayReconfigCallback(CGDirectDisplayID display, } #endif +DictionaryValue* NewDescriptionValuePair(const std::string& desc, + const std::string& value) { + DictionaryValue* dict = new DictionaryValue(); + dict->SetString("description", desc); + dict->SetString("value", value); + return dict; +} + +DictionaryValue* NewDescriptionValuePair(const std::string& desc, + Value* value) { + DictionaryValue* dict = new DictionaryValue(); + dict->SetString("description", desc); + dict->Set("value", value); + return dict; +} + +#if defined(OS_WIN) +// Output DxDiagNode tree as nested array of {description,value} pairs +ListValue* DxDiagNodeToList(const DxDiagNode& node) { + ListValue* list = new ListValue(); + for (std::map<std::string, std::string>::const_iterator it = + node.values.begin(); + it != node.values.end(); + ++it) { + list->Append(NewDescriptionValuePair(it->first, it->second)); + } + + for (std::map<std::string, DxDiagNode>::const_iterator it = + node.children.begin(); + it != node.children.end(); + ++it) { + ListValue* sublist = DxDiagNodeToList(it->second); + list->Append(NewDescriptionValuePair(it->first, sublist)); + } + return list; +} + +#endif // OS_WIN + } // namespace anonymous GpuDataManager::GpuDataManager() @@ -243,6 +282,51 @@ void GpuDataManager::HandleGpuSwitch() { // relaunch GPU process. } +DictionaryValue* GpuDataManager::GpuInfoAsDictionaryValue() const { + ListValue* basic_info = new ListValue(); + basic_info->Append(NewDescriptionValuePair( + "Initialization time", + base::Int64ToString(gpu_info().initialization_time.InMilliseconds()))); + basic_info->Append(NewDescriptionValuePair( + "Vendor Id", base::StringPrintf("0x%04x", gpu_info().vendor_id))); + basic_info->Append(NewDescriptionValuePair( + "Device Id", base::StringPrintf("0x%04x", gpu_info().device_id))); + basic_info->Append(NewDescriptionValuePair("Driver vendor", + gpu_info().driver_vendor)); + basic_info->Append(NewDescriptionValuePair("Driver version", + gpu_info().driver_version)); + basic_info->Append(NewDescriptionValuePair("Driver date", + gpu_info().driver_date)); + basic_info->Append(NewDescriptionValuePair("Pixel shader version", + gpu_info().pixel_shader_version)); + basic_info->Append(NewDescriptionValuePair("Vertex shader version", + gpu_info().vertex_shader_version)); + basic_info->Append(NewDescriptionValuePair("GL version", + gpu_info().gl_version)); + basic_info->Append(NewDescriptionValuePair("GL_VENDOR", + gpu_info().gl_vendor)); + basic_info->Append(NewDescriptionValuePair("GL_RENDERER", + gpu_info().gl_renderer)); + basic_info->Append(NewDescriptionValuePair("GL_VERSION", + gpu_info().gl_version_string)); + basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", + gpu_info().gl_extensions)); + + DictionaryValue* info = new DictionaryValue(); + info->Set("basic_info", basic_info); + +#if defined(OS_WIN) + Value* dx_info; + if (gpu_info().dx_diagnostics.children.size()) + dx_info = DxDiagNodeToList(gpu_info().dx_diagnostics); + else + dx_info = Value::CreateNullValue(); + info->Set("diagnostics", dx_info); +#endif + + return info; +} + void GpuDataManager::RunGpuInfoUpdateCallbacks() { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, diff --git a/content/browser/gpu/gpu_data_manager.h b/content/browser/gpu/gpu_data_manager.h index 19a5682..a5a40d0 100644 --- a/content/browser/gpu/gpu_data_manager.h +++ b/content/browser/gpu/gpu_data_manager.h @@ -80,6 +80,9 @@ class GpuDataManager { // This gets called when switching GPU might have happened. void HandleGpuSwitch(); + // Returns the Gpu Info as a DictionaryValue. + DictionaryValue* GpuInfoAsDictionaryValue() const; + private: friend struct DefaultSingletonTraits<GpuDataManager>; |