Commit Graph

11 Commits

Author SHA1 Message Date
f4433ef14e Add argument support for stand-alone WebRTC tracing.
BUG=webrtc:6186

Review-Url: https://codereview.webrtc.org/2215153003
Cr-Commit-Position: refs/heads/master@{#13670}
2016-08-08 11:10:17 +00:00
bb19a60832 Fix a memory leak where EventLogger is created two times in the event tracer.
R=tommi@webrtc.org

Review-Url: https://codereview.webrtc.org/2179903004
Cr-Commit-Position: refs/heads/master@{#13536}
2016-07-26 17:39:15 +00:00
843b6f503f Fix a crash in the event tracing shutdown path
This CL fixes a crash that could happen when JSON event tracing is
shutting down. The cause of the crash was the fact that the logger
thread function was returning 'true', causing the platform thread to run
it repeatedly even though that wasn't the intention.

Usually the EventLogger::Stop() function would set the event requesting
the logging thread to clean up and close the file, and then immediately
call PlatformThread::Stop() which would stop the outer loop. The Log()
function would only run once and everything behaves as expected.

However, if a context switch happens between the shutdown_event_.Set()
and logging_thread_.Stop() calls in EventLogger::Stop(), the logger
thread function would close the file and exit the Log() method, while
PlatformThread will rerun it again. So the Log() function runs twice,
and the second time output_file_ is NULL which either causes the DCHECK
to fail (in debug builds) or the fprintf() to crash with SIGSEGV (in
release builds).

The fix simply changes the return value of the thread function to false
so it never runs twice.

R=pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/2168283002 .

Cr-Commit-Position: refs/heads/master@{#13510}
2016-07-23 04:45:45 +00:00
0ec9a9b9fc Lower event-tracing log-thread priority.
Lowers risk of the event-tracing thread affecting measurements (and
performance of device). Entirely speculative, but shouldn't hurt.
Timings are still done on the thread that calls the trace macros.

BUG=
R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/2013363002 .

Cr-Commit-Position: refs/heads/master@{#12943}
2016-05-27 09:11:52 +00:00
dda8a837ce Trace tracing Start/Stop events.
Permits measuring times from start of recording (usually start of a
call), and not time from first event that occurs after tracing starts.

BUG=
R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1746693002 .

Cr-Commit-Position: refs/heads/master@{#11815}
2016-02-29 13:54:14 +00:00
455a252453 Fix pointer compare-and-swap on Windows.
Incorrect argument order, also added unittest which should've been there
in the first place.

Also renames AtomicLoadPtr to AcquireLoadPtr to match non-ptr version.

BUG=
R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1537923003 .

Cr-Commit-Position: refs/heads/master@{#11086}
2015-12-18 16:00:35 +00:00
43e4e23eeb Remove thread-id wraparounds in event tracing.
Prints tid as a DWORD on Windows and an int on other systems.

BUG=
R=thakis@chromium.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1522483002 .

Cr-Commit-Position: refs/heads/master@{#10992}
2015-12-11 19:29:47 +00:00
55bcf0f087 Fix -Wformat error in Win-Clang build (take 2)
I managed to cast the wrong parameter in #10982 :-(

BUG=82385

Review URL: https://codereview.webrtc.org/1520493003

Cr-Commit-Position: refs/heads/master@{#10983}
2015-12-11 03:49:30 +00:00
013e83b31c Fix -Wformat error in Win-Clang build
rtc::PlatformThreadId is pid_t (32-bit signed int) on Linux and Mac,
but DWORD (32-bit unsigned int) on Windows.

Using the %d printf specifier is therefore not correct on Windows,
and Clang would warn about it:

..\..\third_party\webrtc\base\event_tracer.cc(124,46) :  error: format specifies
type 'int' but the argument has type 'rtc::PlatformThreadId' (aka 'unsigned
long') [-Werror,-Wformat]
                e.phase, e.timestamp, e.pid, e.tid);
                                             ^~~~~

This commit fixes the problem by explicitly casting to int before printing.

BUG=82385

Review URL: https://codereview.webrtc.org/1514253002 .

Cr-Commit-Position: refs/heads/master@{#10982}
2015-12-11 00:17:03 +00:00
6f28cf0b95 Implement standalone event tracing in AppRTCDemo.
Logs tracing events (TRACE_EVENT0 and friends) to storage in a format
compatible with chrome://tracing which can be used for performance
evaluation, finding lock contention and other sweet things). Tracing is
still basic and doesn't contain thread metadata or logging of tracing
arguments.

BUG=webrtc:5158
R=tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1457383002 .

Cr-Commit-Position: refs/heads/master@{#10921}
2015-12-07 22:17:26 +00:00
7c64ed2e0c Move trace_event and associated files to webrtc/base.
Also starting to use TRACE_EVENT from thread.cc in webrtc/base, to track Invoke() calls.

BUG=
R=magjed@webrtc.org, tina.legrand@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/42769004

Cr-Commit-Position: refs/heads/master@{#8755}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8755 4adac7df-926f-26a2-2b94-8c16560cd09d
2015-03-17 14:26:15 +00:00