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

Unified Diff: cc/ipc/cc_serialization_perftest.cc

Issue 2196873002: CC serialization perftests: more accurate "num runs in 2 seconds". (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 4 months 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/ipc/cc_serialization_perftest.cc
diff --git a/cc/ipc/cc_serialization_perftest.cc b/cc/ipc/cc_serialization_perftest.cc
index 30d7835a1cc4198be9a3c84717abdece2f27a150..e7a4a5266da644ab4148a7bf04cfa2e9243fd9ed 100644
--- a/cc/ipc/cc_serialization_perftest.cc
+++ b/cc/ipc/cc_serialization_perftest.cc
@@ -56,19 +56,22 @@ class CCSerializationPerfTest : public testing::Test {
base::TimeTicks start = base::TimeTicks::Now();
base::TimeTicks end =
start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
+ base::TimeTicks now = start;
base::TimeDelta min_time;
size_t count = 0;
while (start < end) {
for (int i = 0; i < kTimeCheckInterval; ++i) {
- ++count;
CompositorFrame compositor_frame;
ReadMessage(&msg, &compositor_frame);
+ now = base::TimeTicks::Now();
+ // We don't count iterations after the end time.
+ if (now < end)
+ ++count;
}
- base::TimeTicks now = base::TimeTicks::Now();
if (now - start < min_time || min_time.is_zero())
min_time = now - start;
- start = base::TimeTicks::Now();
+ start = now;
}
perf_test::PrintResult(
@@ -89,19 +92,22 @@ class CCSerializationPerfTest : public testing::Test {
base::TimeTicks start = base::TimeTicks::Now();
base::TimeTicks end =
start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
+ base::TimeTicks now = start;
base::TimeDelta min_time;
size_t count = 0;
while (start < end) {
for (int i = 0; i < kTimeCheckInterval; ++i) {
IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL);
IPC::ParamTraits<CompositorFrame>::Write(&msg, frame);
- ++count;
+ now = base::TimeTicks::Now();
+ // We don't count iterations after the end time.
+ if (now < end)
+ ++count;
}
- base::TimeTicks now = base::TimeTicks::Now();
if (now - start < min_time || min_time.is_zero())
min_time = now - start;
- start = base::TimeTicks::Now();
+ start = now;
}
perf_test::PrintResult(
@@ -124,19 +130,22 @@ class CCSerializationPerfTest : public testing::Test {
base::TimeTicks start = base::TimeTicks::Now();
base::TimeTicks end =
start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
+ base::TimeTicks now = start;
base::TimeDelta min_time;
size_t count = 0;
while (start < end) {
for (int i = 0; i < kTimeCheckInterval; ++i) {
CompositorFrame compositor_frame;
mojom::CompositorFrame::Deserialize(data, &compositor_frame);
- ++count;
+ now = base::TimeTicks::Now();
+ // We don't count iterations after the end time.
+ if (now < end)
+ ++count;
}
- base::TimeTicks now = base::TimeTicks::Now();
if (now - start < min_time || min_time.is_zero())
min_time = now - start;
- start = base::TimeTicks::Now();
+ start = now;
}
perf_test::PrintResult(
@@ -158,19 +167,22 @@ class CCSerializationPerfTest : public testing::Test {
base::TimeTicks start = base::TimeTicks::Now();
base::TimeTicks end =
start + base::TimeDelta::FromMilliseconds(kTimeLimitMillis);
+ base::TimeTicks now = start;
base::TimeDelta min_time;
size_t count = 0;
while (start < end) {
for (int i = 0; i < kTimeCheckInterval; ++i) {
mojo::Array<uint8_t> data = mojom::CompositorFrame::Serialize(&frame);
DCHECK_GT(data.size(), 0u);
- ++count;
+ now = base::TimeTicks::Now();
+ // We don't count iterations after the end time.
+ if (now < end)
+ ++count;
}
- base::TimeTicks now = base::TimeTicks::Now();
if (now - start < min_time || min_time.is_zero())
min_time = now - start;
- start = base::TimeTicks::Now();
+ start = now;
}
perf_test::PrintResult(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698