summaryrefslogtreecommitdiffstats
path: root/content/browser/tcmalloc_internals_request_job.h
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 00:05:17 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-25 00:05:17 +0000
commit3d662c390fa7908b4366e0b1a77298fc67178f3e (patch)
treeb34b318b9c048c8eb6b792b16ea414c3e5c4fdc2 /content/browser/tcmalloc_internals_request_job.h
parentf99a712d8b469025ccafdbe006fcebd6544271f8 (diff)
downloadchromium_src-3d662c390fa7908b4366e0b1a77298fc67178f3e.zip
chromium_src-3d662c390fa7908b4366e0b1a77298fc67178f3e.tar.gz
chromium_src-3d662c390fa7908b4366e0b1a77298fc67178f3e.tar.bz2
Show gpu process stats in about:tcmalloc
BUG=123939 TEST=launch GPU process by navigating to a page requiring it. open about:tcmalloc. refresh. see GPU process memory information Review URL: http://codereview.chromium.org/10041017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133816 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/tcmalloc_internals_request_job.h')
-rw-r--r--content/browser/tcmalloc_internals_request_job.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/content/browser/tcmalloc_internals_request_job.h b/content/browser/tcmalloc_internals_request_job.h
new file mode 100644
index 0000000..a602d8f
--- /dev/null
+++ b/content/browser/tcmalloc_internals_request_job.h
@@ -0,0 +1,64 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_
+#define CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_
+#pragma once
+
+#include <map>
+#include "base/basictypes.h"
+#include "base/memory/singleton.h"
+#include "base/process.h"
+#include "build/build_config.h" // USE_TCMALLOC
+#include "content/public/common/process_type.h"
+#include "net/url_request/url_request_simple_job.h"
+
+namespace content {
+
+class AboutTcmallocOutputs {
+ public:
+ // Returns the singleton instance.
+ static AboutTcmallocOutputs* GetInstance();
+
+ // Records the output for a specified header string.
+ void SetOutput(const std::string& header, const std::string& output);
+
+ void DumpToHTMLTable(std::string* data);
+
+ // Callback for output returned from a child process. Adds
+ // the output for a canonical process-specific header string that
+ // incorporates the pid.
+ void OnStatsForChildProcess(base::ProcessId pid,
+ ProcessType process_type,
+ const std::string& output);
+
+ private:
+ AboutTcmallocOutputs();
+ ~AboutTcmallocOutputs();
+
+ // A map of header strings (e.g. "Browser", "Renderer PID 123")
+ // to the tcmalloc output collected for each process.
+ typedef std::map<std::string, std::string> AboutTcmallocOutputsType;
+ AboutTcmallocOutputsType outputs_;
+
+ friend struct DefaultSingletonTraits<AboutTcmallocOutputs>;
+
+ DISALLOW_COPY_AND_ASSIGN(AboutTcmallocOutputs);
+};
+
+class TcmallocInternalsRequestJob : public net::URLRequestSimpleJob {
+ public:
+ explicit TcmallocInternalsRequestJob(net::URLRequest* request);
+
+ virtual bool GetData(std::string* mime_type,
+ std::string* charset,
+ std::string* data) const OVERRIDE;
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(TcmallocInternalsRequestJob);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_TCMALLOC_INTERNALS_REQUEST_JOB_H_