|
Ninja
|
Implementation of the Status interface that prints the status as human-readable strings to stdout. More...
#include <status_printer.h>

Classes | |
| struct | SlidingRateInfo |
Public Member Functions | |
| void | BuildEdgeFinished (Edge *edge, int64_t start_time_millis, int64_t end_time_millis, ExitStatus exit_code, const std::string &output) override |
| void | BuildEdgeStarted (const Edge *edge, int64_t start_time_millis) override |
| void | BuildFinished () override |
| void | BuildStarted () override |
| void | EdgeAddedToPlan (const Edge *edge) override |
| Callbacks for the Plan to notify us about adding/removing Edge's. More... | |
| void | EdgeRemovedFromPlan (const Edge *edge) override |
| void | Error (const char *msg,...) override |
| std::string | FormatProgressStatus (const char *progress_status_format, int64_t time_millis) const |
| Format the progress status string by replacing the placeholders. More... | |
| void | Info (const char *msg,...) override |
| void | SetExplanations (Explanations *explanations) override |
Set the |explanations_| pointer. Used to implement -d explain. More... | |
| StatusPrinter (const BuildConfig &config) | |
| void | Warning (const char *msg,...) override |
Static Public Member Functions | |
| static Status * | factory (const BuildConfig &) |
| creates the actual implementation More... | |
Private Member Functions | |
| void | PrintStatus (const Edge *edge, int64_t time_millis) |
| void | RecalculateProgressPrediction () |
| template<size_t S> | |
| void | SnprintfRate (double rate, char(&buf)[S], const char *format) const |
Private Attributes | |
| const BuildConfig & | config_ |
| int64_t | cpu_time_millis_ = 0 |
| How much cpu clock elapsed so far? More... | |
| SlidingRateInfo | current_rate_ |
| int64_t | eta_predictable_cpu_time_remaining_millis_ = 0 |
| And how much time will they all take? More... | |
| int64_t | eta_predictable_cpu_time_total_millis_ = 0 |
| And how much time did they all take? More... | |
| int | eta_predictable_edges_remaining_ = 0 |
| Out of all the non-finished edges, for how many do we know previous time? More... | |
| int | eta_predictable_edges_total_ = 0 |
| Out of all the edges, for how many do we know previous time? More... | |
| int | eta_unpredictable_edges_remaining_ = 0 |
| For how many edges we don't know the previous run time? More... | |
| Explanations * | explanations_ = nullptr |
An optional Explanations pointer, used to implement -d explain. More... | |
| int | finished_edges_ |
| LinePrinter | printer_ |
| Prints progress output. More... | |
| const char * | progress_status_format_ |
| The custom progress status format to use. More... | |
| int | running_edges_ |
| int | started_edges_ |
| int64_t | time_millis_ = 0 |
| How much wall clock elapsed so far? More... | |
| double | time_predicted_percentage_ = 0.0 |
| What percentage of predicted total time have elapsed already? More... | |
| int | total_edges_ |
Implementation of the Status interface that prints the status as human-readable strings to stdout.
Definition at line 26 of file status_printer.h.
|
explicit |
Definition at line 44 of file status_printer.cc.
References config_, BuildConfig::NORMAL, printer_, progress_status_format_, LinePrinter::set_smart_terminal(), and BuildConfig::verbosity.
|
overridevirtual |
Implements Status.
Definition at line 177 of file status_printer.cc.
References config_, cpu_time_millis_, eta_predictable_cpu_time_remaining_millis_, eta_predictable_edges_remaining_, eta_unpredictable_edges_remaining_, Edge::EvaluateCommand(), ExitSuccess, finished_edges_, Edge::outputs_, Edge::prev_elapsed_time_millis, printer_, LinePrinter::PrintOnNewLine(), PrintStatus(), BuildConfig::QUIET, running_edges_, LinePrinter::SetConsoleLocked(), StripAnsiEscapeCodes(), LinePrinter::supports_color(), time_millis_, Edge::use_console(), and BuildConfig::verbosity.
|
overridevirtual |
Implements Status.
Definition at line 85 of file status_printer.cc.
References LinePrinter::is_smart_terminal(), printer_, PrintStatus(), running_edges_, LinePrinter::SetConsoleLocked(), started_edges_, time_millis_, and Edge::use_console().
|
overridevirtual |
Implements Status.
Definition at line 259 of file status_printer.cc.
References printer_, LinePrinter::PrintOnNewLine(), and LinePrinter::SetConsoleLocked().
|
overridevirtual |
Implements Status.
Definition at line 253 of file status_printer.cc.
References finished_edges_, running_edges_, and started_edges_.
Referenced by TEST().
|
overridevirtual |
Callbacks for the Plan to notify us about adding/removing Edge's.
Implements Status.
Definition at line 57 of file status_printer.cc.
References eta_predictable_cpu_time_remaining_millis_, eta_predictable_cpu_time_total_millis_, eta_predictable_edges_remaining_, eta_predictable_edges_total_, eta_unpredictable_edges_remaining_, Edge::prev_elapsed_time_millis, and total_edges_.
|
overridevirtual |
Implements Status.
Definition at line 71 of file status_printer.cc.
References eta_predictable_cpu_time_remaining_millis_, eta_predictable_cpu_time_total_millis_, eta_predictable_edges_remaining_, eta_predictable_edges_total_, eta_unpredictable_edges_remaining_, Edge::prev_elapsed_time_millis, and total_edges_.
|
overridevirtual |
Implements Status.
Definition at line 451 of file status_printer.cc.
|
staticinherited |
creates the actual implementation
Definition at line 40 of file status_printer.cc.
| string StatusPrinter::FormatProgressStatus | ( | const char * | progress_status_format, |
| int64_t | time_millis | ||
| ) | const |
Format the progress status string by replacing the placeholders.
See the user manual for more information about the available placeholders.
| progress_status_format | The format of the progress status. |
| status | The status of the edge. |
Definition at line 264 of file status_printer.cc.
References current_rate_, Fatal(), finished_edges_, FORMAT_TIME_HMMSS, FORMAT_TIME_MMSS, StatusPrinter::SlidingRateInfo::rate(), running_edges_, SnprintfRate(), started_edges_, time_millis_, time_predicted_percentage_, total_edges_, and StatusPrinter::SlidingRateInfo::UpdateRate().
Referenced by PrintStatus(), and TEST().
|
overridevirtual |
Implements Status.
Definition at line 458 of file status_printer.cc.
Definition at line 408 of file status_printer.cc.
References config_, LinePrinter::ELIDE, explanations_, FormatProgressStatus(), LinePrinter::FULL, Edge::GetBinding(), Explanations::LookupAndAppend(), BuildConfig::NO_STATUS_UPDATE, Edge::outputs_, LinePrinter::Print(), printer_, LinePrinter::PrintOnNewLine(), progress_status_format_, BuildConfig::QUIET, RecalculateProgressPrediction(), BuildConfig::VERBOSE, and BuildConfig::verbosity.
Referenced by BuildEdgeFinished(), and BuildEdgeStarted().
|
private |
Definition at line 98 of file status_printer.cc.
References cpu_time_millis_, eta_predictable_cpu_time_remaining_millis_, eta_predictable_cpu_time_total_millis_, eta_predictable_edges_remaining_, eta_predictable_edges_total_, eta_unpredictable_edges_remaining_, finished_edges_, time_millis_, time_predicted_percentage_, and total_edges_.
Referenced by PrintStatus().
|
inlineoverridevirtual |
Set the |explanations_| pointer. Used to implement -d explain.
Implements Status.
Definition at line 53 of file status_printer.h.
References explanations_.
|
inlineprivate |
Definition at line 98 of file status_printer.h.
Referenced by FormatProgressStatus().
|
overridevirtual |
Implements Status.
Definition at line 444 of file status_printer.cc.
|
private |
Definition at line 60 of file status_printer.h.
Referenced by BuildEdgeFinished(), PrintStatus(), and StatusPrinter().
|
private |
How much cpu clock elapsed so far?
Definition at line 68 of file status_printer.h.
Referenced by BuildEdgeFinished(), and RecalculateProgressPrediction().
|
mutableprivate |
Definition at line 129 of file status_printer.h.
Referenced by FormatProgressStatus().
|
private |
And how much time will they all take?
Definition at line 81 of file status_printer.h.
Referenced by BuildEdgeFinished(), EdgeAddedToPlan(), EdgeRemovedFromPlan(), and RecalculateProgressPrediction().
|
private |
And how much time did they all take?
Definition at line 76 of file status_printer.h.
Referenced by EdgeAddedToPlan(), EdgeRemovedFromPlan(), and RecalculateProgressPrediction().
|
private |
Out of all the non-finished edges, for how many do we know previous time?
Definition at line 79 of file status_printer.h.
Referenced by BuildEdgeFinished(), EdgeAddedToPlan(), EdgeRemovedFromPlan(), and RecalculateProgressPrediction().
|
private |
Out of all the edges, for how many do we know previous time?
Definition at line 74 of file status_printer.h.
Referenced by EdgeAddedToPlan(), EdgeRemovedFromPlan(), and RecalculateProgressPrediction().
|
private |
For how many edges we don't know the previous run time?
Definition at line 84 of file status_printer.h.
Referenced by BuildEdgeFinished(), EdgeAddedToPlan(), EdgeRemovedFromPlan(), and RecalculateProgressPrediction().
|
private |
An optional Explanations pointer, used to implement -d explain.
Definition at line 92 of file status_printer.h.
Referenced by PrintStatus(), and SetExplanations().
|
private |
Definition at line 62 of file status_printer.h.
Referenced by BuildEdgeFinished(), BuildStarted(), FormatProgressStatus(), and RecalculateProgressPrediction().
|
private |
Prints progress output.
Definition at line 89 of file status_printer.h.
Referenced by BuildEdgeFinished(), BuildEdgeStarted(), BuildFinished(), PrintStatus(), and StatusPrinter().
|
private |
The custom progress status format to use.
Definition at line 95 of file status_printer.h.
Referenced by PrintStatus(), and StatusPrinter().
|
private |
Definition at line 62 of file status_printer.h.
Referenced by BuildEdgeFinished(), BuildEdgeStarted(), BuildStarted(), and FormatProgressStatus().
|
private |
Definition at line 62 of file status_printer.h.
Referenced by BuildEdgeStarted(), BuildStarted(), and FormatProgressStatus().
|
private |
How much wall clock elapsed so far?
Definition at line 65 of file status_printer.h.
Referenced by BuildEdgeFinished(), BuildEdgeStarted(), FormatProgressStatus(), and RecalculateProgressPrediction().
|
private |
What percentage of predicted total time have elapsed already?
Definition at line 71 of file status_printer.h.
Referenced by FormatProgressStatus(), and RecalculateProgressPrediction().
|
private |
Definition at line 62 of file status_printer.h.
Referenced by EdgeAddedToPlan(), EdgeRemovedFromPlan(), FormatProgressStatus(), and RecalculateProgressPrediction().