Ninja
Classes | Public Types | Public Member Functions | Public Attributes
BuildLog Struct Reference

Store a log of every command ran for every build. More...

#include <build_log.h>

List of all members.

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.
LogEntryLookupByOutput (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

BuildConfigconfig_
Log log_
FILE * log_file_
bool needs_recompaction_

Detailed Description

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.


Member Typedef Documentation

Definition at line 72 of file build_log.h.


Constructor & Destructor Documentation

BuildLog::BuildLog ( )

Definition at line 40 of file build_log.cc.

BuildLog::~BuildLog ( ) [inline]

Definition at line 37 of file build_log.h.


Member Function Documentation

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 
)
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().

Referenced by main(), and TEST_F().

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 
)
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 
)

Member Data Documentation

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().

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().


The documentation for this struct was generated from the following files: