X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gold%2Fworkqueue.cc;h=06c48c50486ce14a552290b49d9aea381dae7d4e;hb=5024637fac653914d471808288dc3221bc7ec089;hp=18c39003abdadbbd04bcc9cec1c5ac239e4c7690;hpb=2ea97941102380c28117882600265c1187c6fc8b;p=deliverable%2Fbinutils-gdb.git diff --git a/gold/workqueue.cc b/gold/workqueue.cc index 18c39003ab..06c48c5048 100644 --- a/gold/workqueue.cc +++ b/gold/workqueue.cc @@ -1,6 +1,6 @@ // workqueue.cc -- the workqueue for gold -// Copyright 2006, 2007, 2008 Free Software Foundation, Inc. +// Copyright (C) 2006-2019 Free Software Foundation, Inc. // Written by Ian Lance Taylor . // This file is part of gold. @@ -24,6 +24,7 @@ #include "debug.h" #include "options.h" +#include "timer.h" #include "workqueue.h" #include "workqueue-internal.h" @@ -109,7 +110,7 @@ class Workqueue_threader_single : public Workqueue_threader { gold_assert(thread_count > 0); } bool - should_cancel_thread() + should_cancel_thread(int) { return false; } }; @@ -201,9 +202,9 @@ Workqueue::queue_next(Task* t) // Return whether to cancel the current thread. inline bool -Workqueue::should_cancel_thread() +Workqueue::should_cancel_thread(int thread_number) { - return this->threader_->should_cancel_thread(); + return this->threader_->should_cancel_thread(thread_number); } // Find a runnable task in TASKS. Return NULL if none could be found. @@ -263,7 +264,7 @@ Workqueue::find_runnable_or_wait(int thread_number) return NULL; } - if (this->should_cancel_thread()) + if (this->should_cancel_thread(thread_number)) return NULL; gold_debug(DEBUG_TASK, "%3d sleeping", thread_number); @@ -311,10 +312,24 @@ Workqueue::find_and_run_task(int thread_number) gold_debug(DEBUG_TASK, "%3d running task %s", thread_number, t->name().c_str()); + Timer timer; + if (is_debugging_enabled(DEBUG_TASK)) + timer.start(); + t->run(this); - gold_debug(DEBUG_TASK, "%3d completed task %s", thread_number, - t->name().c_str()); + if (is_debugging_enabled(DEBUG_TASK)) + { + Timer::TimeStats elapsed = timer.get_elapsed_time(); + + gold_debug(DEBUG_TASK, + "%3d completed task %s " + "(user: %ld.%06ld sys: %ld.%06ld wall: %ld.%06ld)", + thread_number, t->name().c_str(), + elapsed.user / 1000, (elapsed.user % 1000) * 1000, + elapsed.sys / 1000, (elapsed.sys % 1000) * 1000, + elapsed.wall / 1000, (elapsed.wall % 1000) * 1000); + } Task* next; {