public static void publishInitialRecords() { ThreadRecorder.get().record(ExecutionType.INITIAL_METADATA, Recorder.EmptyBlock, new Recorder.Property("build_id", UUID.randomUUID().toString()), new Recorder.Property("os_name", System.getProperty("os.name")), new Recorder.Property("os_version", System.getProperty("os.version")), new Recorder.Property("java_version", System.getProperty("java.version")), new Recorder.Property("java_vm_version", System.getProperty("java.vm.version")), new Recorder.Property("max_memory", Long.toString(Runtime.getRuntime().maxMemory()))); }
@Override public void record( @NonNull ExecutionType executionType, @NonNull String projectPath, @Nullable String variant, @NonNull VoidBlock block) { ProfileRecordWriter profileRecordWriter = ProcessProfileWriter.get(); GradleBuildProfileSpan.Builder currentRecord = create(profileRecordWriter, executionType, null); try { block.call(); } catch (IOException e) { throw new UncheckedIOException(e); } finally { write(profileRecordWriter, currentRecord, projectPath, variant); } }
@Nullable @Override public <T> T record( @NonNull ExecutionType executionType, @Nullable GradleTransformExecution transform, @NonNull String projectPath, @Nullable String variant, @NonNull Block<T> block) { ProfileRecordWriter profileRecordWriter = ProcessProfileWriter.get(); GradleBuildProfileSpan.Builder currentRecord = create(profileRecordWriter, executionType, transform); try { return block.call(); } catch (Exception e) { block.handleException(e); } finally { write(profileRecordWriter, currentRecord, projectPath, variant); } // we always return null when an exception occurred and was not rethrown. return null; }
public static void shutdown() throws InterruptedException { synchronized (LOCK) { List<GarbageCollectorMXBean> garbageCollectorMXBeans = ManagementFactory .getGarbageCollectorMXBeans(); ThreadRecorder.get().record(ExecutionType.FINAL_METADATA, Recorder.EmptyBlock, new Recorder.Property("build_time", Long.toString(System.currentTimeMillis() - sINSTANCE.startTime)), new Recorder.Property("gc_count", Long.toString(garbageCollectorMXBeans.get(0).getCollectionCount() - sINSTANCE.gcCountAtStart)), new Recorder.Property("gc_time", Long.toString(garbageCollectorMXBeans.get(0).getCollectionTime() - sINSTANCE.gcTimeAtStart))); if (sINSTANCE.isInitialized()) { sINSTANCE.get().finish(); sINSTANCE.uploadData(); } sINSTANCE.processRecorder = null; } }
ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_MANIFEST_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_GENERATE_RES_VALUES_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_CREATE_RENDERSCRIPT_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_RESOURCES_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_MERGE_ASSETS_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_BUILD_CONFIG_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_PREPROCESS_RESOURCES_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.APP_TASK_MANAGER_CREATE_PROCESS_RES_TASK,
ThreadRecorder.get().record(ExecutionType.VARIANT_MANAGER_CREATE_TESTS_TASKS, new Recorder.Block<Void>() { @Override
ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_GENERATE_RES_VALUES_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_MERGE_MANIFEST_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_CREATE_RENDERSCRIPT_TASK, new Recorder.Block<Void>() { @Override AndroidTask<MergeResources> packageRes = ThreadRecorder.get().record( ExecutionType.LIB_TASK_MANAGER_CREATE_MERGE_RESOURCES_TASK, new Recorder.Block<AndroidTask<MergeResources>>() { ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_MERGE_ASSETS_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_BUILD_CONFIG_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_BACKPORT_RESOURCES_TASK, new Recorder.Block<Void>() { @Override ThreadRecorder.get().record(ExecutionType.LIB_TASK_MANAGER_CREATE_PROCESS_RES_TASK,