Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: tools/DumpRecord.cpp

Issue 1458943002: restore dump_record (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (int) Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/tools.gyp ('k') | tools/dump_record.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/DumpRecord.cpp
diff --git a/tools/DumpRecord.cpp b/tools/DumpRecord.cpp
index 667c9ef5060a876d8afc736c43d1323348d26aa4..e2662e758c96569206a4f4b56c9f34613c063f7e 100644
--- a/tools/DumpRecord.cpp
+++ b/tools/DumpRecord.cpp
@@ -11,7 +11,7 @@
#include "SkRecordDraw.h"
#include "DumpRecord.h"
-#include "Timer.h"
+#include "SkTime.h"
namespace {
@@ -31,12 +31,9 @@ public:
template <typename T>
void operator()(const T& command) {
- Timer timer;
- timer.start();
- fDraw(command);
- timer.end();
-
- this->print(command, timer.fCpu);
+ auto start = SkTime::GetNSecs();
+ fDraw(command);
+ this->print(command, SkTime::GetNSecs() - start);
}
void operator()(const SkRecords::NoOp&) {
@@ -44,37 +41,38 @@ public:
}
template <typename T>
- void print(const T& command, double time) {
- this->printNameAndTime(command, time);
+ void print(const T& command, double ns) {
+ this->printNameAndTime(command, ns);
}
- void print(const SkRecords::Restore& command, double time) {
+ void print(const SkRecords::Restore& command, double ns) {
--fIndent;
- this->printNameAndTime(command, time);
+ this->printNameAndTime(command, ns);
}
- void print(const SkRecords::Save& command, double time) {
- this->printNameAndTime(command, time);
+ void print(const SkRecords::Save& command, double ns) {
+ this->printNameAndTime(command, ns);
++fIndent;
}
- void print(const SkRecords::SaveLayer& command, double time) {
- this->printNameAndTime(command, time);
+ void print(const SkRecords::SaveLayer& command, double ns) {
+ this->printNameAndTime(command, ns);
++fIndent;
}
private:
template <typename T>
- void printNameAndTime(const T& command, double time) {
+ void printNameAndTime(const T& command, double ns) {
+ int us = (int)(ns * 1e-3);
if (!fTimeWithCommand) {
- printf("%6.1f ", time * 1000);
+ printf("%6dus ", us);
}
printf("%*d ", fDigits, fIndex++);
for (int i = 0; i < fIndent; i++) {
- putchar('\t');
+ printf(" ");
}
if (fTimeWithCommand) {
- printf("%6.1f ", time * 1000);
+ printf("%6dus ", us);
}
puts(NameOf(command));
}
« no previous file with comments | « gyp/tools.gyp ('k') | tools/dump_record.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698