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

Side by Side Diff: Source/platform/scheduler/TracedTask.cpp

Issue 490913002: Adding flow traces for blink scheduler events (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: atomicIncrement only done if needed. ID generation moved into TracedTask. Created 6 years, 3 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
OLDNEW
(Empty)
1 // Copyright 2014 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 #include "config.h"
6 #include "platform/scheduler/TracedTask.h"
7
8 namespace blink {
9
10 int TracedTask::s_nextFlowTraceID = 0;
11
12 void TracedTask::run() const
13 {
14 TRACE_EVENT_FLOW_END0("blink", m_traceName, TRACE_ID_MANGLE(m_flowTraceID));
15
16 TRACE_EVENT2("blink", m_traceName,
17 "src_file", m_location.fileName(),
18 "src_func", m_location.functionName());
19
20 m_task();
21 }
22
23 TracedTask::TracedTask(const Task& task, const TraceLocation& location, const ch ar* traceName)
24 : m_task(task)
25 , m_location(location)
26 , m_traceName(traceName)
27 {
28 bool tracingEnabled;
29 TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink", &tracingEnabled);
eseidel 2014/09/04 06:49:13 Is there also a check for flow events? My underst
Sami 2014/09/04 09:51:07 Only whole categories can be enabled or disabled.
30
31 if (tracingEnabled) {
32 // atomicIncrement is slow so we only do it if tracing is enabled
33 m_flowTraceID = atomicIncrement(&s_nextFlowTraceID);
34
35 TRACE_EVENT_FLOW_BEGIN2("blink", m_traceName, TRACE_ID_MANGLE(m_flowTrac eID),
36 "src_file", m_location.fileName(),
37 "src_func", m_location.functionName());
38 }
39 }
40
41 } // namespace blink
OLDNEW
« Source/platform/scheduler/TracedTask.h ('K') | « Source/platform/scheduler/TracedTask.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698