66 const size_t kRuleSize = 4000;
67 string long_rule_command =
"gcc ";
68 for (
int i = 0; long_rule_command.size() < kRuleSize; ++i) {
70 sprintf(buf,
"-I../../and/arbitrary/but/fairly/long/path/suffixed/%d ", i);
71 long_rule_command += buf;
73 long_rule_command +=
"$in -o $out\n";
77 if (!parser.
ParseTest(
"rule cxx\n command = " + long_rule_command, err))
82 const int kNumCommands = 30000;
84 for (
int i = 0; i < kNumCommands; ++i) {
86 sprintf(buf,
"build input%d.o: cxx input%d.cc\n", i, i);
93 for (
int i = 0; i < kNumCommands; ++i) {
108 fprintf(stderr,
"Failed to write test data: %s\n", err.c_str());
116 fprintf(stderr,
"Failed to read test data: %s\n", err.c_str());
120 const int kNumRepetitions = 5;
121 for (
int i = 0; i < kNumRepetitions; ++i) {
125 fprintf(stderr,
"Failed to read test data: %s\n", err.c_str());
129 printf(
"%dms\n", delta);
130 times.push_back(delta);
136 for (
size_t i = 0; i < times.size(); ++i) {
140 else if (times[i] > max)
144 printf(
"min %dms max %dms avg %.1fms\n",
145 min, max, total / times.size());
const char kTestFilename[]
bool WriteTestData(string *err)
int64_t GetTimeMillis()
Get the current time as relative to some epoch.
Can answer questions about the manifest for the BuildLog.
Store a log of every command ran for every build.
LoadStatus Load(const std::string &path, std::string *err)
Load the on-disk log.
bool OpenForWrite(const std::string &path, const BuildLogUser &user, std::string *err)
Prepares writing to the log file without actually opening it - that will happen when/if it's needed.
bool RecordCommand(Edge *edge, int start_time, int end_time, TimeStamp mtime=0)
bool ParseTest(const std::string &input, std::string *err)
Parse a text string of input. Used by tests.
virtual bool IsPathDead(StringPiece) const
Return if a given output is no longer part of the build manifest.
Global state (file status) for a single run.
std::vector< Edge * > edges_
All the edges of the graph.
StringPiece represents a slice of a string whose memory is managed externally.
int platformAwareUnlink(const char *filename)
signed long long int64_t
A 64-bit integer type.