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

Side by Side Diff: base/debug/trace_event_impl.h

Issue 11366109: Adding raw tracing to trace framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 5
6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_ 6 #ifndef BASE_DEBUG_TRACE_EVENT_IMPL_H_
7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_ 7 #define BASE_DEBUG_TRACE_EVENT_IMPL_H_
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 long long threshold, 274 long long threshold,
275 unsigned char flags); 275 unsigned char flags);
276 static void AddTraceEventEtw(char phase, 276 static void AddTraceEventEtw(char phase,
277 const char* name, 277 const char* name,
278 const void* id, 278 const void* id,
279 const char* extra); 279 const char* extra);
280 static void AddTraceEventEtw(char phase, 280 static void AddTraceEventEtw(char phase,
281 const char* name, 281 const char* name,
282 const void* id, 282 const void* id,
283 const std::string& extra); 283 const std::string& extra);
284 int AddTraceRawEvent(char phase,
285 const unsigned char* category_enabled,
286 const char* thread_name,
287 const char* name,
288 int64 timestamp,
289 unsigned long long id,
290 int num_args,
291 const char** arg_names,
292 const unsigned char* arg_types,
293 const unsigned long long* arg_values,
294 int threshold_begin_id,
295 long long threshold,
296 unsigned char flags);
284 297
285 // For every matching event, a notification will be fired. NOTE: the 298 // For every matching event, a notification will be fired. NOTE: the
286 // notification will fire for each matching event that has already occurred 299 // notification will fire for each matching event that has already occurred
287 // since tracing was started (including before tracing if the process was 300 // since tracing was started (including before tracing if the process was
288 // started with tracing turned on). 301 // started with tracing turned on).
289 void SetWatchEvent(const std::string& category_name, 302 void SetWatchEvent(const std::string& category_name,
290 const std::string& event_name); 303 const std::string& event_name);
291 // Cancel the watch event. If tracing is enabled, this may race with the 304 // Cancel the watch event. If tracing is enabled, this may race with the
292 // watch event notification firing. 305 // watch event notification firing.
293 void CancelWatchEvent(); 306 void CancelWatchEvent();
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 void SendToATrace(char phase, 361 void SendToATrace(char phase,
349 const char* category, 362 const char* category,
350 const char* name, 363 const char* name,
351 int num_args, 364 int num_args,
352 const char** arg_names, 365 const char** arg_names,
353 const unsigned char* arg_types, 366 const unsigned char* arg_types,
354 const unsigned long long* arg_values); 367 const unsigned long long* arg_values);
355 void AddClockSyncMetadataEvents(); 368 void AddClockSyncMetadataEvents();
356 #endif 369 #endif
357 370
371 int AddTraceEventInternal(NotificationHelper& notifier,
372 TimeTicks timestamp,
373 char phase,
374 const unsigned char* category_enabled,
375 int thread_id,
376 const char* name,
377 unsigned long long id,
378 int num_args,
379 const char** arg_names,
380 const unsigned char* arg_types,
381 const unsigned long long* arg_values,
382 int threshold_begin_id,
383 long long threshold,
384 unsigned char flags);
385
358 // TODO(nduca): switch to per-thread trace buffers to reduce thread 386 // TODO(nduca): switch to per-thread trace buffers to reduce thread
359 // synchronization. 387 // synchronization.
360 // This lock protects TraceLog member accesses from arbitrary threads. 388 // This lock protects TraceLog member accesses from arbitrary threads.
361 Lock lock_; 389 Lock lock_;
362 bool enabled_; 390 bool enabled_;
363 NotificationCallback notification_callback_; 391 NotificationCallback notification_callback_;
364 std::vector<TraceEvent> logged_events_; 392 std::vector<TraceEvent> logged_events_;
365 std::vector<std::string> included_categories_; 393 std::vector<std::string> included_categories_;
366 std::vector<std::string> excluded_categories_; 394 std::vector<std::string> excluded_categories_;
367 bool dispatching_to_observer_list_; 395 bool dispatching_to_observer_list_;
368 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_; 396 ObserverList<EnabledStateChangedObserver> enabled_state_observer_list_;
369 397
370 base::hash_map<int, std::string> thread_names_; 398 base::hash_map<int, std::string> thread_names_;
371 399
400 base::hash_map<std::string, int> fake_thread_names_;
401 int next_fake_thread_id_;
402
372 // XORed with TraceID to make it unlikely to collide with other processes. 403 // XORed with TraceID to make it unlikely to collide with other processes.
373 unsigned long long process_id_hash_; 404 unsigned long long process_id_hash_;
374 405
375 int process_id_; 406 int process_id_;
376 407
377 // Allow tests to wake up when certain events occur. 408 // Allow tests to wake up when certain events occur.
378 const unsigned char* watch_category_; 409 const unsigned char* watch_category_;
379 std::string watch_event_name_; 410 std::string watch_event_name_;
380 411
381 DISALLOW_COPY_AND_ASSIGN(TraceLog); 412 DISALLOW_COPY_AND_ASSIGN(TraceLog);
382 }; 413 };
383 414
384 } // namespace debug 415 } // namespace debug
385 } // namespace base 416 } // namespace base
386 417
387 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_ 418 #endif // BASE_DEBUG_TRACE_EVENT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698