OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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. | |
4 | |
5 #ifndef COMPONENTS_TRACING_GRAPHICS_MEMORY_DUMP_PROVIDER_ANDROID_H_ | |
6 #define COMPONENTS_TRACING_GRAPHICS_MEMORY_DUMP_PROVIDER_ANDROID_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/containers/hash_tables.h" | |
11 #include "base/gtest_prod_util.h" | |
12 #include "base/memory/singleton.h" | |
13 #include "base/trace_event/memory_dump_provider.h" | |
14 #include "components/tracing/tracing_export.h" | |
15 | |
16 namespace tracing { | |
17 | |
18 // Dump provider which collects memory stats about graphics memory on Android. | |
19 // This requires the presence of the memtrack_helper daemon, which must be | |
20 // executed separetely via a (root) adb shell command. The dump provider will | |
21 // fail (and hence disabled by the MemoryDumpManager) in absence of the helper. | |
22 // See the design-doc https://goo.gl/4Y30p9 for more details. | |
23 class TRACING_EXPORT GraphicsMemoryDumpProvider | |
24 : public base::trace_event::MemoryDumpProvider { | |
25 public: | |
26 static GraphicsMemoryDumpProvider* GetInstance(); | |
27 | |
28 // MemoryDumpProvider implementation. | |
29 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | |
30 base::trace_event::ProcessMemoryDump* pmd) override; | |
31 | |
32 private: | |
33 FRIEND_TEST_ALL_PREFIXES(GraphicsMemoryDumpProviderTest, ParseResponse); | |
Robert Sesek
2015/10/13 22:38:39
Where's the test?
Primiano Tucci (use gerrit)
2015/10/14 08:44:34
Oh, this line should really be moved to crrev.com/
| |
34 friend struct base::DefaultSingletonTraits<GraphicsMemoryDumpProvider>; | |
35 | |
36 void ParseResponseAndAddToDump(const char* buf, | |
37 size_t length, | |
38 base::trace_event::ProcessMemoryDump* pmd); | |
39 | |
40 GraphicsMemoryDumpProvider(); | |
41 ~GraphicsMemoryDumpProvider() override; | |
42 | |
43 static const char kDumpBaseName[]; // Used by the unittest. | |
44 | |
45 // Stores key names coming from the memtrack helper in long-lived storage. | |
46 // This is to allow using cheap char* strings in tracing without copies. | |
47 base::hash_set<std::string> key_names_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(GraphicsMemoryDumpProvider); | |
50 }; | |
51 | |
52 } // namespace tracing | |
53 | |
54 #endif // COMPONENTS_TRACING_GRAPHICS_MEMORY_DUMP_PROVIDER_ANDROID_H_ | |
OLD | NEW |