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

Side by Side Diff: components/metrics/child_call_stack_profile_collector_unittest.cc

Issue 2927593002: Make stack sampling profiler sample beyond startup. (Closed)
Patch Set: Address some comments. Created 3 years, 5 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/child_call_stack_profile_collector.h" 5 #include "components/metrics/child_call_stack_profile_collector.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 53
54 ChildCallStackProfileCollectorTest() 54 ChildCallStackProfileCollectorTest()
55 : receiver_impl_(new Receiver(MakeRequest(&receiver_))) {} 55 : receiver_impl_(new Receiver(MakeRequest(&receiver_))) {}
56 56
57 void CollectEmptyProfiles( 57 void CollectEmptyProfiles(
58 const CallStackProfileParams& params, 58 const CallStackProfileParams& params,
59 size_t profile_count) { 59 size_t profile_count) {
60 base::StackSamplingProfiler::CallStackProfiles profiles; 60 base::StackSamplingProfiler::CallStackProfiles profiles;
61 for (size_t i = 0; i < profile_count; ++i) 61 for (size_t i = 0; i < profile_count; ++i)
62 profiles.push_back(base::StackSamplingProfiler::CallStackProfile()); 62 profiles.push_back(base::StackSamplingProfiler::CallStackProfile());
63 child_collector_.GetProfilerCallback(params).Run(std::move(profiles)); 63 base::StackSamplingProfiler::SamplingParams sampling_params;
64 child_collector_.GetProfilerCallback(params).Run(std::move(profiles),
65 &sampling_params);
64 } 66 }
65 67
66 const std::vector<ChildCallStackProfileCollector::ProfilesState>& 68 const std::vector<ChildCallStackProfileCollector::ProfilesState>&
67 profiles() const { 69 profiles() const {
68 return child_collector_.profiles_; 70 return child_collector_.profiles_;
69 } 71 }
70 72
71 base::MessageLoop loop_; 73 base::MessageLoop loop_;
72 mojom::CallStackProfileCollectorPtr receiver_; 74 mojom::CallStackProfileCollectorPtr receiver_;
73 std::unique_ptr<Receiver> receiver_impl_; 75 std::unique_ptr<Receiver> receiver_impl_;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 CollectEmptyProfiles( 170 CollectEmptyProfiles(
169 CallStackProfileParams(CallStackProfileParams::GPU_PROCESS, 171 CallStackProfileParams(CallStackProfileParams::GPU_PROCESS,
170 CallStackProfileParams::GPU_MAIN_THREAD, 172 CallStackProfileParams::GPU_MAIN_THREAD,
171 CallStackProfileParams::THREAD_HUNG, 173 CallStackProfileParams::THREAD_HUNG,
172 CallStackProfileParams::PRESERVE_ORDER), 174 CallStackProfileParams::PRESERVE_ORDER),
173 1); 175 1);
174 EXPECT_EQ(0u, profiles().size()); 176 EXPECT_EQ(0u, profiles().size());
175 } 177 }
176 178
177 } // namespace metrics 179 } // namespace metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698