• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Systrace类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.facebook.systrace.Systrace的典型用法代码示例。如果您正苦于以下问题:Java Systrace类的具体用法?Java Systrace怎么用?Java Systrace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Systrace类属于com.facebook.systrace包,在下文中一共展示了Systrace类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: onProducerStart

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public void onProducerStart(String requestId, String producerName) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  StringBuilder entryName = new StringBuilder();
  entryName.append("FRESCO_PRODUCER_");
  entryName.append(producerName.replace(':', '_'));

  Pair<Integer,String> requestPair = Pair.create(mCurrentID, entryName.toString());
  Systrace.beginAsyncSection(
      Systrace.TRACE_TAG_REACT_FRESCO,
      requestPair.second,
      mCurrentID);
  mProducerID.put(requestId, requestPair);
  mCurrentID++;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:SystraceRequestListener.java


示例2: onProducerFinishWithSuccess

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:SystraceRequestListener.java


示例3: onProducerFinishWithFailure

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:SystraceRequestListener.java


示例4: onProducerFinishWithCancellation

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:SystraceRequestListener.java


示例5: onProducerEvent

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public void onProducerEvent(String requestId, String producerName, String producerEventName) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  StringBuilder entryName = new StringBuilder();
  entryName.append("FRESCO_PRODUCER_EVENT_");
  entryName.append(requestId.replace(':', '_'));
  entryName.append("_");
  entryName.append(producerName.replace(':', '_'));
  entryName.append("_");
  entryName.append(producerEventName.replace(':', '_'));
  Systrace.traceInstant(
      Systrace.TRACE_TAG_REACT_FRESCO,
      entryName.toString(),
      Systrace.EventScope.THREAD);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:SystraceRequestListener.java


示例6: onRequestStart

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public void onRequestStart(
    ImageRequest request,
    Object callerContext,
    String requestId,
    boolean isPrefetch) {
  if (!Systrace.isTracing(Systrace.TRACE_TAG_REACT_FRESCO)) {
    return;
  }

  StringBuilder entryName = new StringBuilder();
  entryName.append("FRESCO_REQUEST_");
  entryName.append(request.getSourceUri().toString().replace(':', '_'));

  Pair<Integer,String> requestPair = Pair.create(mCurrentID, entryName.toString());
  Systrace.beginAsyncSection(
      Systrace.TRACE_TAG_REACT_FRESCO,
      requestPair.second,
      mCurrentID);
  mRequestsID.put(requestId, requestPair);
  mCurrentID++;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:23,代码来源:SystraceRequestListener.java


示例7: onRequestFailure

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:20,代码来源:SystraceRequestListener.java


示例8: createNativeModules

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public final List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
  List<NativeModule> modules = new ArrayList<>();
  for (ModuleSpec holder : getNativeModules(reactContext)) {
    NativeModule nativeModule;
    SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createNativeModule")
      .arg("module", holder.getType())
      .flush();
    try {
      ReactMarker.logMarker(
        ReactMarkerConstants.CREATE_MODULE_START,
        holder.getType().getSimpleName());
      nativeModule = holder.getProvider().get();
      ReactMarker.logMarker(ReactMarkerConstants.CREATE_MODULE_END);
    } finally {
      Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    }
    modules.add(nativeModule);
  }
  return modules;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:LazyReactPackage.java


示例9: createAllViewManagers

import com.facebook.systrace.Systrace; //导入依赖的package包/类
/**
 * Uses configured {@link ReactPackage} instances to create all view managers.
 */
public List<ViewManager> createAllViewManagers(
    ReactApplicationContext catalystApplicationContext) {
  ReactMarker.logMarker(CREATE_VIEW_MANAGERS_START);
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createAllViewManagers");
  try {
    List<ViewManager> allViewManagers = new ArrayList<>();
    for (ReactPackage reactPackage : mPackages) {
      allViewManagers.addAll(reactPackage.createViewManagers(catalystApplicationContext));
    }
    return allViewManagers;
  } finally {
    Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(CREATE_VIEW_MANAGERS_END);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:ReactInstanceManager.java


示例10: attachMeasuredRootViewToInstance

import com.facebook.systrace.Systrace; //导入依赖的package包/类
private void attachMeasuredRootViewToInstance(
    ReactRootView rootView,
    CatalystInstance catalystInstance) {
  Systrace.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "attachMeasuredRootViewToInstance");
  UiThreadUtil.assertOnUiThread();

  // Reset view content as it's going to be populated by the application content from JS
  rootView.removeAllViews();
  rootView.setId(View.NO_ID);

  UIManagerModule uiManagerModule = catalystInstance.getNativeModule(UIManagerModule.class);
  int rootTag = uiManagerModule.addMeasuredRootView(rootView);
  rootView.setRootViewTag(rootTag);
  @Nullable Bundle launchOptions = rootView.getLaunchOptions();
  WritableMap initialProps = Arguments.makeNativeMap(launchOptions);
  String jsAppModuleName = rootView.getJSModuleName();

  WritableNativeMap appParams = new WritableNativeMap();
  appParams.putDouble("rootTag", rootTag);
  appParams.putMap("initialProps", initialProps);
  catalystInstance.getJSModule(AppRegistry.class).runApplication(jsAppModuleName, appParams);
  rootView.onAttachedToReactInstance();
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:25,代码来源:ReactInstanceManager.java


示例11: processPackage

import com.facebook.systrace.Systrace; //导入依赖的package包/类
private void processPackage(
  ReactPackage reactPackage,
  NativeModuleRegistryBuilder nativeModuleRegistryBuilder,
  JavaScriptModuleRegistry.Builder jsModulesBuilder) {
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processPackage")
    .arg("className", reactPackage.getClass().getSimpleName())
    .flush();
  if (reactPackage instanceof ReactPackageLogger) {
    ((ReactPackageLogger) reactPackage).startProcessPackage();
  }
  nativeModuleRegistryBuilder.processPackage(reactPackage);

  for (Class<? extends JavaScriptModule> jsModuleClass : reactPackage.createJSModules()) {
    jsModulesBuilder.add(jsModuleClass);
  }
  if (reactPackage instanceof ReactPackageLogger) {
    ((ReactPackageLogger) reactPackage).endProcessPackage();
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ReactInstanceManager.java


示例12: doFrameGuarded

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public void doFrameGuarded(long frameTimeNanos) {
  if (mIsInIllegalUIState) {
    FLog.w(
      ReactConstants.TAG,
      "Not flushing pending UI operations because of previously thrown Exception");
    return;
  }

  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "dispatchNonBatchedUIOperations");
  try {
    dispatchPendingNonBatchedOperations(frameTimeNanos);
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }

  flushPendingBatches();

  ReactChoreographer.getInstance().postFrameCallback(
    ReactChoreographer.CallbackType.DISPATCH_UI, this);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:UIViewOperationQueue.java


示例13: dispatchEvent

import com.facebook.systrace.Systrace; //导入依赖的package包/类
/**
 * Sends the given Event to JS, coalescing eligible events if JS is backed up.
 */
public void dispatchEvent(Event event) {
  Assertions.assertCondition(event.isInitialized(), "Dispatched event hasn't been initialized");

  for (EventDispatcherListener listener : mListeners) {
    listener.onEventDispatch(event);
  }

  synchronized (mEventsStagingLock) {
    mEventStaging.add(event);
    Systrace.startAsyncFlow(
        Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
        event.getEventName(),
        event.getUniqueID());
  }
  if (mRCTEventEmitter != null) {
    // If the host activity is paused, the frame callback may not be currently
    // posted. Ensure that it is so that this event gets delivered promptly.
    mCurrentFrameCallback.maybePostFromNonUI();
  } else {
    // No JS application has started yet, or resumed. This can happen when a ReactRootView is
    // added to view hierarchy, but ReactContext creation has not completed yet. In this case, any
    // touch event dispatch will hit this codepath, and we simply queue them so that they
    // are dispatched once ReactContext creation completes and JS app is running.
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:29,代码来源:EventDispatcher.java


示例14: doFrame

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public void doFrame(long frameTimeNanos) {
  UiThreadUtil.assertOnUiThread();

  if (mShouldStop) {
    mIsPosted = false;
  } else {
    post();
  }

  Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "ScheduleDispatchFrameCallback");
  try {
    moveStagedEventsToDispatchQueue();

    if (mEventsToDispatchSize > 0 && !mHasDispatchScheduled) {
      mHasDispatchScheduled = true;
      Systrace.startAsyncFlow(
          Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
          "ScheduleDispatchFrameCallback",
          mHasDispatchScheduledCount);
      mReactContext.runOnJSQueueThread(mDispatchEventsRunnable);
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:27,代码来源:EventDispatcher.java


示例15: create

import com.facebook.systrace.Systrace; //导入依赖的package包/类
private NativeModule create() {
  SoftAssertions.assertCondition(mModule == null, "Creating an already created module.");
  ReactMarker.logMarker(CREATE_MODULE_START, mName);
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createModule")
    .arg("name", mName)
    .flush();
  NativeModule module = assertNotNull(mProvider).get();
  mProvider = null;
  if (mInitializeNeeded) {
    doInitialize(module);
    mInitializeNeeded = false;
  }
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
  ReactMarker.logMarker(CREATE_MODULE_END);
  return module;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:ModuleHolder.java


示例16: runJSBundle

import com.facebook.systrace.Systrace; //导入依赖的package包/类
@Override
public void runJSBundle() {
  Assertions.assertCondition(!mJSBundleHasLoaded, "JS bundle was already loaded!");
  mJSBundleHasLoaded = true;

  // incrementPendingJSCalls();
  mJSBundleLoader.loadScript(CatalystInstanceImpl.this);

  synchronized (mJSCallsPendingInitLock) {
    // Loading the bundle is queued on the JS thread, but may not have
    // run yet.  It's safe to set this here, though, since any work it
    // gates will be queued on the JS thread behind the load.
    mAcceptCalls = true;

    for (PendingJSCall call : mJSCallsPendingInit) {
      jniCallJSFunction(call.mExecutorToken, call.mModule, call.mMethod, call.mArguments);
    }
    mJSCallsPendingInit.clear();
  }

  // This is registered after JS starts since it makes a JS call
  Systrace.registerListener(mTraceListener);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:24,代码来源:CatalystInstanceImpl.java


示例17: incrementPendingJSCalls

import com.facebook.systrace.Systrace; //导入依赖的package包/类
private void incrementPendingJSCalls() {
  int oldPendingCalls = mPendingJSCalls.getAndIncrement();
  boolean wasIdle = oldPendingCalls == 0;
  Systrace.traceCounter(
      Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
      mJsPendingCallsTitleForTrace,
      oldPendingCalls + 1);
  if (wasIdle && !mBridgeIdleListeners.isEmpty()) {
    mNativeModulesQueueThread.runOnQueue(new Runnable() {
      @Override
      public void run() {
        for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) {
          listener.onTransitionToBridgeBusy();
        }
      }
    });
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:CatalystInstanceImpl.java


示例18: decrementPendingJSCalls

import com.facebook.systrace.Systrace; //导入依赖的package包/类
private void decrementPendingJSCalls() {
  int newPendingCalls = mPendingJSCalls.decrementAndGet();
  // TODO(9604406): handle case of web workers injecting messages to main thread
  //Assertions.assertCondition(newPendingCalls >= 0);
  boolean isNowIdle = newPendingCalls == 0;
  Systrace.traceCounter(
      Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
      mJsPendingCallsTitleForTrace,
      newPendingCalls);

  if (isNowIdle && !mBridgeIdleListeners.isEmpty()) {
    mNativeModulesQueueThread.runOnQueue(new Runnable() {
      @Override
      public void run() {
        for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners) {
          listener.onTransitionToBridgeIdle();
        }
      }
    });
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:CatalystInstanceImpl.java


示例19: notifyJSInstanceInitialized

import com.facebook.systrace.Systrace; //导入依赖的package包/类
void notifyJSInstanceInitialized() {
  mReactApplicationContext.assertOnNativeModulesQueueThread("From version React Native v0.44, " +
    "native modules are explicitly not initialized on the UI thread. See " +
    "https://github.com/facebook/react-native/wiki/Breaking-Changes#d4611211-reactnativeandroidbreaking-move-nativemodule-initialization-off-ui-thread---aaachiuuu " +
    " for more details.");
  ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_START);
  Systrace.beginSection(
      Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
      "NativeModuleRegistry_notifyJSInstanceInitialized");
  try {
    for (ModuleHolder module : mModules.values()) {
      module.initialize();
    }
  } finally {
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
    ReactMarker.logMarker(ReactMarkerConstants.NATIVE_MODULE_INITIALIZE_END);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:NativeModuleRegistry.java


示例20: processArguments

import com.facebook.systrace.Systrace; //导入依赖的package包/类
private void processArguments() {
  if (mArgumentsProcessed) {
    return;
  }
  SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "processArguments")
    .arg("method", mModuleWrapper.getName() + "." + mMethod.getName())
    .flush();
  mArgumentsProcessed = true;
  mArgumentExtractors = buildArgumentExtractors(mParameterTypes);
  mSignature = buildSignature(mMethod, mParameterTypes, (mType.equals(BaseJavaModule.METHOD_TYPE_SYNC)));
  // Since native methods are invoked from a message queue executed on a single thread, it is
  // safe to allocate only one arguments object per method that can be reused across calls
  mArguments = new Object[mParameterTypes.length];
  mJSArgumentsNeeded = calculateJSArgumentsNeeded();
  com.facebook.systrace.Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:17,代码来源:JavaMethodWrapper.java



注:本文中的com.facebook.systrace.Systrace类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CompilationException类代码示例发布时间:2022-05-23
下一篇:
Java TreeFileChooser类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap