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

Side by Side Diff: components/scheduler/renderer/renderer_task_duration_unittest.cc

Issue 2184023002: Report the duration of sampled tasks with histogram. (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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/scheduler/renderer/renderer_task_duration.h"
6
7 #include "base/test/histogram_tester.h"
8 #include "base/metrics/histogram_macros.h"
majidvp 2016/07/27 13:50:59 histogram_macros.h seems to be an unnecessary incl
sunyunjia 2016/07/27 17:28:43 Done.
9 #include "testing/gmock/include/gmock/gmock.h"
majidvp 2016/07/27 13:50:59 ditto gmock.h
sunyunjia 2016/07/27 17:28:43 Done.
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace scheduler {
13 typedef testing::Test RendererTaskDurationTest;
14 TEST_F(RendererTaskDurationTest, LoggingDuration) {
majidvp 2016/07/27 13:50:59 Using a text fixture is not necessary here. You ca
sunyunjia 2016/07/27 17:28:43 Done.
15 base::HistogramTester tester;
16
17 RendererTaskDuration rtd;
18 for (int i = 1; i <= rtd.kSampleInterval + 1; ++i) {
majidvp 2016/07/27 13:50:59 Please spell out 100 in the test rather than using
sunyunjia 2016/07/27 17:28:43 Done.
19 int num = i % rtd.kSampleInterval;
20 int msecond = 10 * 1000 / rtd.kSampleInterval * num + 1;
majidvp 2016/07/27 13:50:59 s/msceond/milliseconds/
majidvp 2016/07/27 13:50:59 This expression seems a bit too overcomplicated fo
sunyunjia 2016/07/27 17:28:43 Done.
sunyunjia 2016/07/27 17:28:43 Done.
21 base::TimeDelta duration = base::TimeDelta::FromMilliseconds(msecond);
22 rtd.ReportSampleDuration(duration);
23 }
24 tester.ExpectUniqueSample("RendererScheduler.TaskDuration", 1, 1);
majidvp 2016/07/27 13:50:59 Why are we asserting for 1 here? It is hard to cor
sunyunjia 2016/07/27 17:28:43 Done.
25 }
26 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698