|
Ninja
|
Store a log of every command ran for every build. More...
#include <build_log.h>
Classes | |
| struct | LogEntry |
Public Types | |
| typedef ExternalStringHashMap < LogEntry * >::Type | Log |
Public Member Functions | |
| BuildLog () | |
| void | Close () |
| bool | Load (const string &path, string *err) |
| Load the on-disk log. | |
| LogEntry * | LookupByOutput (const string &path) |
| Lookup a previously-run command by its output path. | |
| bool | OpenForWrite (const string &path, string *err) |
| bool | Recompact (const string &path, string *err) |
| Rewrite the known log entries, throwing away old data. | |
| void | RecordCommand (Edge *edge, int start_time, int end_time, time_t restat_mtime=0) |
| void | SetConfig (BuildConfig *config) |
| void | WriteEntry (FILE *f, const LogEntry &entry) |
| Serialize an entry into a log file. | |
| ~BuildLog () | |
Public Attributes | |
| BuildConfig * | config_ |
| Log | log_ |
| FILE * | log_file_ |
| bool | needs_recompaction_ |
Store a log of every command ran for every build.
It has a few uses:
1) historical command lines for output files, so we know when we need to rebuild due to the command changing 2) historical timing information 3) maybe we can generate some sort of build overview output from it
Definition at line 35 of file build_log.h.
| typedef ExternalStringHashMap<LogEntry*>::Type BuildLog::Log |
Definition at line 72 of file build_log.h.
| BuildLog::BuildLog | ( | ) |
Definition at line 40 of file build_log.cc.
| BuildLog::~BuildLog | ( | ) | [inline] |
Definition at line 37 of file build_log.h.
| void BuildLog::Close | ( | ) |
Definition at line 96 of file build_log.cc.
References log_file_.
Referenced by OpenForWrite(), and TEST_F().
| bool BuildLog::Load | ( | const string & | path, |
| string * | err | ||
| ) |
Load the on-disk log.
Definition at line 102 of file build_log.cc.
References BuildLog::LogEntry::command, BuildLog::LogEntry::end_time, log_, needs_recompaction_, BuildLog::LogEntry::output, BuildLog::LogEntry::restat_mtime, and BuildLog::LogEntry::start_time.
| BuildLog::LogEntry * BuildLog::LookupByOutput | ( | const string & | path | ) |
Lookup a previously-run command by its output path.
Definition at line 203 of file build_log.cc.
References log_.
Referenced by Edge::RecomputeOutputDirty(), and TEST_F().
| bool BuildLog::OpenForWrite | ( | const string & | path, |
| string * | err | ||
| ) |
Definition at line 43 of file build_log.cc.
References Close(), config_, BuildConfig::dry_run, log_file_, needs_recompaction_, Recompact(), and SetCloseOnExec().
| bool BuildLog::Recompact | ( | const string & | path, |
| string * | err | ||
| ) |
Rewrite the known log entries, throwing away old data.
Definition at line 216 of file build_log.cc.
References log_, and WriteEntry().
Referenced by OpenForWrite().
| void BuildLog::RecordCommand | ( | Edge * | edge, |
| int | start_time, | ||
| int | end_time, | ||
| time_t | restat_mtime = 0 |
||
| ) |
Definition at line 71 of file build_log.cc.
References BuildLog::LogEntry::command, BuildLog::LogEntry::end_time, Edge::EvaluateCommand(), log_, log_file_, BuildLog::LogEntry::output, Edge::outputs_, BuildLog::LogEntry::restat_mtime, BuildLog::LogEntry::start_time, and WriteEntry().
Referenced by Builder::FinishEdge(), and TEST_F().
| void BuildLog::SetConfig | ( | BuildConfig * | config | ) | [inline] |
Definition at line 39 of file build_log.h.
Referenced by main().
| void BuildLog::WriteEntry | ( | FILE * | f, |
| const LogEntry & | entry | ||
| ) |
Serialize an entry into a log file.
Definition at line 210 of file build_log.cc.
References BuildLog::LogEntry::command, BuildLog::LogEntry::end_time, BuildLog::LogEntry::output, BuildLog::LogEntry::restat_mtime, and BuildLog::LogEntry::start_time.
Referenced by Recompact(), and RecordCommand().
Definition at line 75 of file build_log.h.
Referenced by OpenForWrite().
Definition at line 73 of file build_log.h.
Referenced by Load(), LookupByOutput(), Recompact(), RecordCommand(), and TEST_F().
| FILE* BuildLog::log_file_ |
Definition at line 74 of file build_log.h.
Referenced by Close(), OpenForWrite(), and RecordCommand().
Definition at line 76 of file build_log.h.
Referenced by Load(), and OpenForWrite().
1.7.5.1