Improve debug trace logging.

This commit is contained in:
Sönke Ludwig 2020-11-25 23:24:27 +01:00
parent a44d3f2655
commit 3d1be3b3cb
2 changed files with 3 additions and 1 deletions

View file

@ -428,6 +428,7 @@ package Task runTask_internal(alias TFI_SETUP)()
() @trusted { TaskFiber.ms_taskEventCallback(TaskEvent.preStart, handle); } (); () @trusted { TaskFiber.ms_taskEventCallback(TaskEvent.preStart, handle); } ();
} }
debug (VibeTaskLog) logTrace("Switching to newly created task");
switchToTask(handle); switchToTask(handle);
debug if (TaskFiber.ms_taskEventCallback) { debug if (TaskFiber.ms_taskEventCallback) {

View file

@ -823,6 +823,7 @@ package struct TaskScheduler {
bool any_events = false; bool any_events = false;
while (true) { while (true) {
debug (VibeTaskLog) logTrace("Scheduling before peeking new events...");
// process pending tasks // process pending tasks
bool any_tasks_processed = schedule() != ScheduleStatus.idle; bool any_tasks_processed = schedule() != ScheduleStatus.idle;
@ -952,7 +953,7 @@ package struct TaskScheduler {
auto thistf = () @trusted { return thist.taskFiber; } (); auto thistf = () @trusted { return thist.taskFiber; } ();
assert(!thistf || !thistf.m_queue, "Calling task is running, but scheduled to be resumed!?"); assert(!thistf || !thistf.m_queue, "Calling task is running, but scheduled to be resumed!?");
debug (VibeTaskLog) logDebugV("Switching tasks (%s already in queue)", m_taskQueue.length); debug (VibeTaskLog) logDebugV("Switching tasks (%s already in queue, prio=%s)", m_taskQueue.length, priority);
final switch (priority) { final switch (priority) {
case TaskSwitchPriority.normal: case TaskSwitchPriority.normal:
reschedule(tf); reschedule(tf);