Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Reducing synchronization in TraceControlHandler
Browse files Browse the repository at this point in the history
Summary: Currently `TraceControlHandler` contains a lot of synchronization even from a single threaded execution context.

Reviewed By: BurntBrunch

Differential Revision: D18634346

fbshipit-source-id: eb9aae0f32e3960fa5f588df18a8403d016fb1af
  • Loading branch information
aandreyeu authored and facebook-github-bot committed Nov 21, 2019
1 parent 4d8e4e6 commit 492916a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions java/main/com/facebook/profilo/core/TraceControlHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,17 +106,19 @@ protected synchronized void stopTrace(TraceContext context) {
ProfiloConstants.TRACE_CONFIG_PARAM_POST_TRACE_EXTENSION_MSEC_DEFAULT));
}

protected synchronized void endTrace(TraceContext context) {
protected void endTrace(TraceContext context) {
// This also runs teardown for all providers
if (mListener != null) {
mListener.onTraceStop(context);
}
Logger.postCloseTrace(context.traceId);
}

protected synchronized void abortTrace(TraceContext context) {
protected void abortTrace(TraceContext context) {
// stop any timeout timer associated with the thread
removeMessages(MSG_TIMEOUT_TRACE, context);
synchronized (this) {
removeMessages(MSG_TIMEOUT_TRACE, context);
}
if (mListener != null) {
mListener.onTraceAbort(context);
}
Expand All @@ -130,7 +132,7 @@ protected static void timeoutTrace(long traceId) {
control.timeoutTrace(traceId);
}

protected synchronized void startTraceAsync(TraceContext context) {
protected void startTraceAsync(TraceContext context) {
if (LogLevel.LOG_DEBUG_MESSAGE) {
Log.d(
LOG_TAG,
Expand Down

0 comments on commit 492916a

Please sign in to comment.