24 int main(
int argc,
char* argv[]) {
26 printf(
"usage: %s <file1> <file2...>\n", argv[0]);
31 for (
int i = 1; i < argc; ++i) {
32 const char* filename = argv[i];
34 for (
int limit = 1 << 10; limit < (1<<20); limit *= 2) {
36 for (
int rep = 0; rep < limit; ++rep) {
39 if (
ReadFile(filename, &buf, &err) < 0) {
40 printf(
"%s: %s\n", filename, err.c_str());
45 if (!parser.
Parse(&buf, &err)) {
46 printf(
"%s: %s\n", filename, err.c_str());
52 if (end - start > 100) {
53 int delta = (int)(end - start);
54 float time = delta*1000 / (float)limit;
55 printf(
"%s: %.1fus\n", filename, time);
56 times.push_back(time);
66 for (
size_t i = 0; i < times.size(); ++i) {
70 else if (times[i] > max)
74 printf(
"min %.1fus max %.1fus avg %.1fus\n",
75 min, max, total / times.size());
int main(int argc, char *argv[])
int64_t GetTimeMillis()
Get the current time as relative to some epoch.
Parser for the dependency information emitted by gcc's -M flags.
bool Parse(std::string *content, std::string *err)
Parse an input file.
int ReadFile(const string &path, string *contents, string *err)
signed long long int64_t
A 64-bit integer type.