Java Code Examples for com.facebook.systrace.Systrace#endAsyncSection()

The following examples show how to use com.facebook.systrace.Systrace#endAsyncSection() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystraceRequestListener.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public void onProducerFinishWithSuccess(
    String requestId,
    String producerName,
    Map<String, String> extraMap) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  if (mProducerID.containsKey(requestId)) {
    Pair<Integer, String> entry = mProducerID.get(requestId);
    Systrace.endAsyncSection(
        Systrace.TRACE_TAG_REACT_FRESCO,
        entry.second,
        entry.first);
    mProducerID.remove(requestId);
  }
}
 
Example 2
Source File: SystraceRequestListener.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public void onProducerFinishWithFailure(
    String requestId,
    String producerName,
    Throwable throwable,
    Map<String, String> extraMap) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  if (mProducerID.containsKey(requestId)) {
    Pair<Integer, String> entry = mProducerID.get(requestId);
    Systrace.endAsyncSection(
        Systrace.TRACE_TAG_REACT_FRESCO,
        entry.second,
        entry.first);
    mProducerID.remove(requestId);
  }
}
 
Example 3
Source File: SystraceRequestListener.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public void onProducerFinishWithCancellation(
    String requestId, String producerName, Map<String, String> extraMap) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  if (mProducerID.containsKey(requestId)) {
    Pair<Integer, String> entry = mProducerID.get(requestId);
    Systrace.endAsyncSection(
        Systrace.TRACE_TAG_REACT_FRESCO,
        entry.second,
        entry.first);
    mProducerID.remove(requestId);
  }
}
 
Example 4
Source File: SystraceRequestListener.java    From react-native-GPay with MIT License 6 votes vote down vote up
@Override
public void onRequestFailure(
    ImageRequest request,
    String requestId,
    Throwable throwable,
    boolean isPrefetch) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  if (mRequestsID.containsKey(requestId)) {
    Pair<Integer, String> entry = mRequestsID.get(requestId);
    Systrace.endAsyncSection(
        Systrace.TRACE_TAG_REACT_FRESCO,
        entry.second,
        entry.first);
    mRequestsID.remove(requestId);
  }
}
 
Example 5
Source File: SystraceRequestListener.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void onRequestSuccess(ImageRequest request, String requestId, boolean isPrefetch) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  if (mRequestsID.containsKey(requestId)) {
    Pair<Integer, String> entry = mRequestsID.get(requestId);
    Systrace.endAsyncSection(
        Systrace.TRACE_TAG_REACT_FRESCO,
        entry.second,
        entry.first);
    mRequestsID.remove(requestId);
  }
}
 
Example 6
Source File: SystraceRequestListener.java    From react-native-GPay with MIT License 5 votes vote down vote up
@Override
public void onRequestCancellation(String requestId) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  if (mRequestsID.containsKey(requestId)) {
    Pair<Integer, String> entry = mRequestsID.get(requestId);
    Systrace.endAsyncSection(
        Systrace.TRACE_TAG_REACT_FRESCO,
        entry.second,
        entry.first);
    mRequestsID.remove(requestId);
  }
}
 
Example 7
Source File: UIViewOperationQueue.java    From react-native-GPay with MIT License 5 votes vote down vote up
private void flushPendingBatches() {
  if (mIsInIllegalUIState) {
    FLog.w(
      ReactConstants.TAG,
      "Not flushing pending UI operations because of previously thrown Exception");
    return;
  }

  final ArrayList<Runnable> runnables;
  synchronized (mDispatchRunnablesLock) {
    if (!mDispatchUIRunnables.isEmpty()) {
      runnables = mDispatchUIRunnables;
      mDispatchUIRunnables = new ArrayList<>();
    } else {
      return;
    }
  }

  final long batchedExecutionStartTime = SystemClock.uptimeMillis();
  for (Runnable runnable : runnables) {
    runnable.run();
  }

  if (mIsProfilingNextBatch) {
    mProfiledBatchBatchedExecutionTime = SystemClock.uptimeMillis() - batchedExecutionStartTime;
    mProfiledBatchNonBatchedExecutionTime = mNonBatchedExecutionTotalTime;
    mIsProfilingNextBatch = false;

    Systrace.beginAsyncSection(
        Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
        "batchedExecutionTime",
        0,
        batchedExecutionStartTime * 1000000);
    Systrace.endAsyncSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "batchedExecutionTime", 0);
  }
  mNonBatchedExecutionTotalTime = 0;
}