Skip to content

Commit 0238f06

Browse files
committed
[Tracing] Include task name, isDiscarding, hasExPreference in tracing
1 parent e84e9c3 commit 0238f06

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,12 +1131,14 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
11311131
}
11321132

11331133
// FIXME: add discarding flag
1134-
// FIXME: add task executor
11351134
concurrency::trace::task_create(
11361135
task, parent, group, asyncLet,
11371136
static_cast<uint8_t>(task->Flags.getPriority()),
11381137
task->Flags.task_isChildTask(), task->Flags.task_isFuture(),
1139-
task->Flags.task_isGroupChildTask(), task->Flags.task_isAsyncLetTask());
1138+
task->Flags.task_isGroupChildTask(), task->Flags.task_isAsyncLetTask(),
1139+
taskCreateFlags.isDiscardingTask(),
1140+
task->Flags.task_hasInitialTaskExecutorPreference(),
1141+
taskName);
11401142

11411143
// Attach to the group, if needed.
11421144
if (group) {

stdlib/public/Concurrency/TracingSignpost.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,9 @@ inline void actor_note_job_queue(HeapObject *actor, Job *first,
182182
inline void task_create(AsyncTask *task, AsyncTask *parent, TaskGroup *group,
183183
AsyncLet *asyncLet, uint8_t jobPriority,
184184
bool isChildTask, bool isFuture, bool isGroupChildTask,
185-
bool isAsyncLetTask) {
185+
bool isAsyncLetTask, bool isDiscardingTask,
186+
bool hasInitialTaskExecutorPreference,
187+
const char* taskName) {
186188
ENSURE_LOGS();
187189
auto id = os_signpost_id_make_with_pointer(TaskLog, task);
188190
auto parentID = parent ? parent->getTaskId() : 0;
@@ -191,10 +193,12 @@ inline void task_create(AsyncTask *task, AsyncTask *parent, TaskGroup *group,
191193
"task=%" PRIx64
192194
" resumefn=%p jobPriority=%u isChildTask=%{bool}d, isFuture=%{bool}d "
193195
"isGroupChildTask=%{bool}d isAsyncLetTask=%{bool}d parent=%" PRIx64
194-
" group=%p asyncLet=%p",
196+
" group=%p asyncLet=%p "
197+
"isDiscardingTask=%{bool}d hasInitialTaskExecutorPreference=%{bool}d "
198+
"taskName=%{public}s",
195199
task->getTaskId(), task->getResumeFunctionForLogging(true), jobPriority,
196200
isChildTask, isFuture, isGroupChildTask, isAsyncLetTask, parentID, group,
197-
asyncLet);
201+
asyncLet, isDiscardingTask, hasInitialTaskExecutorPreference, taskName);
198202
}
199203

200204
inline void task_destroy(AsyncTask *task) {

stdlib/public/Concurrency/TracingStubs.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,13 @@ inline void actor_note_job_queue(HeapObject *actor, Job *first,
4444
inline void task_create(AsyncTask *task, AsyncTask *parent, TaskGroup *group,
4545
AsyncLet *asyncLet, uint8_t jobPriority,
4646
bool isChildTask, bool isFuture, bool isGroupChildTask,
47-
bool isAsyncLetTask) {}
47+
bool isAsyncLetTask, bool isDiscardingTask,
48+
bool hasInitialTaskExecutorPreference,
49+
const char* taskName) {}
4850

4951
inline void task_destroy(AsyncTask *task) {}
5052

51-
inline void task_wait(AsyncTask *task, AsyncTask *waitingOn, uintptr_t status) {
52-
}
53+
inline void task_wait(AsyncTask *task, AsyncTask *waitingOn, uintptr_t status) {}
5354

5455
inline void task_resume(AsyncTask *task) {}
5556

0 commit comments

Comments
 (0)