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

Unified Diff: base/trace_event/trace_event.h

Issue 1950313005: [tracing] Move and rename TRACE_EVENT_API_TASK_EXECUTION_EVENT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_missing_task
Patch Set: fix unittest. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event.h
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h
index 542537d7ed96ebf24c2f6d2ad409519404bacdc6..faaccac8eaf34b40ff91b81e633df44246266a6a 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -18,7 +18,7 @@
#include "base/macros.h"
#include "base/time/time.h"
#include "base/trace_event/common/trace_event_common.h"
-#include "base/trace_event/heap_profiler_allocation_context_tracker.h"
+#include "base/trace_event/heap_profiler.h"
#include "base/trace_event/trace_event_system_stats_monitor.h"
#include "base/trace_event/trace_log.h"
#include "build/build_config.h"
@@ -211,10 +211,6 @@ TRACE_EVENT_API_CLASS_EXPORT extern \
#define TRACE_EVENT_API_THREAD_BUCKET(thread_bucket) \
g_trace_state[thread_bucket]
-// Scoped tracker for task execution context in the heap profiler.
-#define TRACE_EVENT_API_SCOPED_TASK_EXECUTION_EVENT \
- trace_event_internal::ScopedTaskExecutionEvent
-
////////////////////////////////////////////////////////////////////////////////
// Implementation detail: trace event macros create temporary variables
@@ -387,6 +383,15 @@ TRACE_EVENT_API_CLASS_EXPORT extern \
INTERNAL_TRACE_EVENT_UID(ScopedContext) \
INTERNAL_TRACE_EVENT_UID(scoped_context)(context.raw_id());
+// Implementation detail: internal macro to trace a task execution with the
+// location where it was posted from.
+#define INTERNAL_TRACE_TASK_EXECUTION(run_function, task) \
+ TRACE_EVENT2("toplevel", run_function, "src_file", \
+ (task).posted_from.file_name(), "src_func", \
+ (task).posted_from.function_name()); \
+ TRACE_HEAP_PROFILER_API_SCOPED_TASK_EXECUTION INTERNAL_TRACE_EVENT_UID( \
+ task_event)((task).posted_from.file_name());
+
namespace trace_event_internal {
// Specify these values when the corresponding argument of AddTraceEvent is not
@@ -1050,35 +1055,6 @@ class TraceEventSamplingStateScope {
const char* previous_state_;
};
-// ScopedTaskExecutionEvent records the current task's context in the heap
-// profiler.
-class ScopedTaskExecutionEvent {
- public:
- explicit ScopedTaskExecutionEvent(const char* task_context)
- : context_(task_context) {
- using base::trace_event::AllocationContextTracker;
- if (UNLIKELY(
- AllocationContextTracker::capture_mode() !=
- AllocationContextTracker::CaptureMode::DISABLED)) {
- AllocationContextTracker::GetInstanceForCurrentThread()
- ->PushCurrentTaskContext(context_);
- }
- }
-
- ~ScopedTaskExecutionEvent() {
- using base::trace_event::AllocationContextTracker;
- if (UNLIKELY(
- AllocationContextTracker::capture_mode() !=
- AllocationContextTracker::CaptureMode::DISABLED)) {
- AllocationContextTracker::GetInstanceForCurrentThread()
- ->PopCurrentTaskContext(context_);
- }
- }
-
- private:
- const char* context_;
-};
-
} // namespace trace_event_internal
namespace base {
« no previous file with comments | « base/trace_event/heap_profiler_allocation_context_tracker_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698