Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1219)

Side by Side Diff: base/test/launcher/test_launcher_tracer.h

Issue 2112253002: Add basic tracing support to the gtest launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sort Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/test/launcher/test_launcher.cc ('k') | base/test/launcher/test_launcher_tracer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 BASE_TEST_LAUNCHER_TEST_LAUNCHER_TRACER_H_
6 #define BASE_TEST_LAUNCHER_TEST_LAUNCHER_TRACER_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/synchronization/lock.h"
12 #include "base/threading/platform_thread.h"
13 #include "base/time/time.h"
14
15 namespace base {
16
17 class FilePath;
18
19 // Records traces of test execution, e.g. to analyze performance.
20 // Thread safe.
21 class TestLauncherTracer {
22 public:
23 TestLauncherTracer();
24 ~TestLauncherTracer();
25
26 // Records an event corresponding to test process execution.
27 void RecordProcessExecution(TimeTicks start_time, TimeDelta duration);
28
29 // Dumps trace data as JSON. Returns true on success.
30 bool Dump(const FilePath& path) WARN_UNUSED_RESULT;
31
32 private:
33 // Simplified version of base::TraceEvent.
34 struct Event {
35 std::string name; // Displayed name.
36 TimeTicks timestamp; // Timestamp when this event began.
37 TimeDelta duration; // How long was this event.
38 PlatformThreadId thread_id; // Thread ID where event was reported.
39 };
40
41 // Timestamp when tracing started.
42 TimeTicks trace_start_time_;
43
44 // Log of trace events.
45 std::vector<Event> events_;
46
47 // Lock to protect all member variables.
48 Lock lock_;
49
50 DISALLOW_COPY_AND_ASSIGN(TestLauncherTracer);
51 };
52
53 } // namespace base
54
55 #endif // BASE_TEST_LAUNCHER_TEST_LAUNCHER_TRACER_H_
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher.cc ('k') | base/test/launcher/test_launcher_tracer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698