@@ -244,29 +244,33 @@ inline void job_enqueue_main_executor(Job *job) {
244244 }
245245}
246246
247- inline uint64_t job_run_begin (Job *job, ExecutorRef *executor) {
247+ inline job_run_info job_run_begin (Job *job, ExecutorRef *executor) {
248+ auto invalidInfo = []{
249+ return job_run_info{ 0 , OS_SIGNPOST_ID_INVALID };
250+ };
251+
248252 if (AsyncTask *task = dyn_cast<AsyncTask>(job)) {
249- ENSURE_LOGS (0 );
250- auto id = os_signpost_id_generate (TaskLog);
253+ ENSURE_LOGS (invalidInfo ());
254+ auto handle = os_signpost_id_generate (TaskLog);
255+ auto taskId = task->getTaskId ();
251256 os_signpost_interval_begin (
252- TaskLog, id , SWIFT_LOG_JOB_RUN_NAME,
257+ TaskLog, handle , SWIFT_LOG_JOB_RUN_NAME,
253258 " task=%" PRIx64
254259 " executorIdentity=%p executorImplementation=0x%" PRIxPTR,
255- task->getTaskId (), executor->getIdentity (),
256- executor->getRawImplementation ());
257- return id;
260+ taskId, executor->getIdentity (), executor->getRawImplementation ());
261+ return { taskId, handle };
258262 }
259- return 0 ;
263+ return invalidInfo () ;
260264}
261265
262- inline void job_run_end (Job *job, ExecutorRef *executor, uint64_t beginHandle ) {
263- if (AsyncTask *task = dyn_cast<AsyncTask>(job) ) {
266+ inline void job_run_end (ExecutorRef *executor, job_run_info info ) {
267+ if (info. handle != OS_SIGNPOST_ID_INVALID ) {
264268 ENSURE_LOGS ();
265269 os_signpost_interval_end (
266- TaskLog, beginHandle , SWIFT_LOG_JOB_RUN_NAME,
270+ TaskLog, info. handle , SWIFT_LOG_JOB_RUN_NAME,
267271 " task=%" PRIx64
268272 " executorIdentity=%p executorImplementation=0x%" PRIxPTR,
269- task-> getTaskId () , executor->getIdentity (),
273+ info. taskId , executor->getIdentity (),
270274 executor->getRawImplementation ());
271275 }
272276}
0 commit comments