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

Side by Side Diff: base/trace_event/trace_sampling_thread.h

Issue 2406703002: tracing: remove sampling state profiler (Closed)
Patch Set: . Created 4 years, 2 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/trace_event/trace_log_constants.cc ('k') | base/trace_event/trace_sampling_thread.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 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 BASE_TRACE_EVENT_TRACE_SAMPLING_THREAD_H_
6 #define BASE_TRACE_EVENT_TRACE_SAMPLING_THREAD_H_
7
8 #include "base/synchronization/cancellation_flag.h"
9 #include "base/synchronization/waitable_event.h"
10 #include "base/trace_event/trace_event.h"
11
12 namespace base {
13 namespace trace_event {
14
15 class TraceBucketData;
16 typedef base::Callback<void(TraceBucketData*)> TraceSampleCallback;
17
18 // This object must be created on the IO thread.
19 class TraceSamplingThread : public PlatformThread::Delegate {
20 public:
21 TraceSamplingThread();
22 ~TraceSamplingThread() override;
23
24 // Implementation of PlatformThread::Delegate:
25 void ThreadMain() override;
26
27 static void DefaultSamplingCallback(TraceBucketData* bucket_data);
28
29 void Stop();
30 void WaitSamplingEventForTesting();
31
32 private:
33 friend class TraceLog;
34
35 void GetSamples();
36 // Not thread-safe. Once the ThreadMain has been called, this can no longer
37 // be called.
38 void RegisterSampleBucket(TRACE_EVENT_API_ATOMIC_WORD* bucket,
39 const char* const name,
40 TraceSampleCallback callback);
41 // Splits a combined "category\0name" into the two component parts.
42 static void ExtractCategoryAndName(const char* combined,
43 const char** category,
44 const char** name);
45 std::vector<TraceBucketData> sample_buckets_;
46 bool thread_running_;
47 CancellationFlag cancellation_flag_;
48 WaitableEvent waitable_event_for_testing_;
49 };
50
51 } // namespace trace_event
52 } // namespace base
53
54 #endif // BASE_TRACE_EVENT_TRACE_SAMPLING_THREAD_H_
OLDNEW
« no previous file with comments | « base/trace_event/trace_log_constants.cc ('k') | base/trace_event/trace_sampling_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698