| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/metrics/perf/perf_provider_chromeos.h" | 5 #include "chrome/browser/metrics/perf/perf_provider_chromeos.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 const std::vector<RandomSelector::WeightAndValue> GetDefaultCommands_x86_64( | 167 const std::vector<RandomSelector::WeightAndValue> GetDefaultCommands_x86_64( |
| 168 const CPUIdentity& cpuid) { | 168 const CPUIdentity& cpuid) { |
| 169 using WeightAndValue = RandomSelector::WeightAndValue; | 169 using WeightAndValue = RandomSelector::WeightAndValue; |
| 170 std::vector<WeightAndValue> cmds; | 170 std::vector<WeightAndValue> cmds; |
| 171 DCHECK_EQ(cpuid.arch, "x86_64"); | 171 DCHECK_EQ(cpuid.arch, "x86_64"); |
| 172 const std::string intel_uarch = GetIntelUarch(cpuid); | 172 const std::string intel_uarch = GetIntelUarch(cpuid); |
| 173 // Haswell and newer big Intel cores support LBR callstack profiling. This | 173 // Haswell and newer big Intel cores support LBR callstack profiling. This |
| 174 // requires kernel support, which was added in kernel 4.4, and it was | 174 // requires kernel support, which was added in kernel 4.4, and it was |
| 175 // backported to kernel 3.18. Prefer LBR callstack profiling where supported | 175 // backported to kernel 3.18. Prefer LBR callstack profiling where supported |
| 176 // instead of FP callchains, because the former works with binaries compiled | 176 // instead of FP callchains, because the former works with binaries compiled |
| 177 // with frame pointers disabled, such as the ARC++ runtime. | 177 // with frame pointers disabled, such as the ARC runtime. |
| 178 const char *callgraph_cmd = kPerfRecordFPCallgraphCmd; | 178 const char *callgraph_cmd = kPerfRecordFPCallgraphCmd; |
| 179 if (MicroarchitectureHasLBRCallgraph(intel_uarch) && | 179 if (MicroarchitectureHasLBRCallgraph(intel_uarch) && |
| 180 KernelReleaseHasLBRCallgraph(cpuid.release)) { | 180 KernelReleaseHasLBRCallgraph(cpuid.release)) { |
| 181 callgraph_cmd = kPerfRecordLBRCallgraphCmd; | 181 callgraph_cmd = kPerfRecordLBRCallgraphCmd; |
| 182 } | 182 } |
| 183 | 183 |
| 184 if (intel_uarch == "IvyBridge" || | 184 if (intel_uarch == "IvyBridge" || |
| 185 intel_uarch == "Haswell" || | 185 intel_uarch == "Haswell" || |
| 186 intel_uarch == "Broadwell") { | 186 intel_uarch == "Broadwell") { |
| 187 cmds.push_back(WeightAndValue(50.0, kPerfRecordCyclesCmd)); | 187 cmds.push_back(WeightAndValue(50.0, kPerfRecordCyclesCmd)); |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 std::unique_ptr<SampledProfile> sampled_profile(new SampledProfile); | 745 std::unique_ptr<SampledProfile> sampled_profile(new SampledProfile); |
| 746 sampled_profile->set_trigger_event(SampledProfile::RESTORE_SESSION); | 746 sampled_profile->set_trigger_event(SampledProfile::RESTORE_SESSION); |
| 747 sampled_profile->set_ms_after_restore(time_after_restore.InMilliseconds()); | 747 sampled_profile->set_ms_after_restore(time_after_restore.InMilliseconds()); |
| 748 sampled_profile->set_num_tabs_restored(num_tabs_restored); | 748 sampled_profile->set_num_tabs_restored(num_tabs_restored); |
| 749 | 749 |
| 750 CollectIfNecessary(std::move(sampled_profile)); | 750 CollectIfNecessary(std::move(sampled_profile)); |
| 751 last_session_restore_collection_time_ = base::TimeTicks::Now(); | 751 last_session_restore_collection_time_ = base::TimeTicks::Now(); |
| 752 } | 752 } |
| 753 | 753 |
| 754 } // namespace metrics | 754 } // namespace metrics |
| OLD | NEW |