Chromium Code Reviews| 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/test/perf/perf_test.h" | 5 #include "chrome/test/perf/perf_test.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | |
| 10 #include "base/file_util.h" | |
| 11 #include "base/lazy_instance.h" | |
| 9 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/path_service.h" | |
| 10 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
| 11 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 12 #include "chrome/test/base/chrome_process_util.h" | 16 #include "chrome/test/base/chrome_process_util.h" |
| 13 | 17 |
| 14 namespace { | 18 namespace { |
| 15 | 19 |
| 20 base::LazyInstance<base::FilePath> default_profile_dir_ = | |
| 21 LAZY_INSTANCE_INITIALIZER; | |
| 22 base::LazyInstance<base::FilePath> complex_profile_dir_ = | |
| 23 LAZY_INSTANCE_INITIALIZER; | |
| 24 | |
| 16 std::string ResultsToString(const std::string& measurement, | 25 std::string ResultsToString(const std::string& measurement, |
| 17 const std::string& modifier, | 26 const std::string& modifier, |
| 18 const std::string& trace, | 27 const std::string& trace, |
| 19 const std::string& values, | 28 const std::string& values, |
| 20 const std::string& prefix, | 29 const std::string& prefix, |
| 21 const std::string& suffix, | 30 const std::string& suffix, |
| 22 const std::string& units, | 31 const std::string& units, |
| 23 bool important) { | 32 bool important) { |
| 24 // <*>RESULT <graph_name>: <trace_name>= <value> <units> | 33 // <*>RESULT <graph_name>: <trace_name>= <value> <units> |
| 25 // <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units> | 34 // <*>RESULT <graph_name>: <trace_name>= {<mean>, <std deviation>} <units> |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 AppendResult(output, | 582 AppendResult(output, |
| 574 "commit_charge", | 583 "commit_charge", |
| 575 std::string(), | 584 std::string(), |
| 576 "cc" + trace_name, | 585 "cc" + trace_name, |
| 577 charge, | 586 charge, |
| 578 "kb", | 587 "kb", |
| 579 important); | 588 important); |
| 580 return output; | 589 return output; |
| 581 } | 590 } |
| 582 | 591 |
| 592 void SetPathForProfileType(ProfileType profile_type, base::FilePath path) { | |
|
Paweł Hajdan Jr.
2013/04/26 23:19:32
I don't really like this global state here.
The q
| |
| 593 switch (profile_type) { | |
| 594 case DEFAULT_THEME: | |
| 595 default_profile_dir_.Get() = path; | |
| 596 break; | |
| 597 case COMPLEX_THEME: | |
| 598 complex_profile_dir_.Get() = path; | |
| 599 break; | |
| 600 default: | |
| 601 NOTREACHED(); | |
| 602 } | |
| 603 } | |
| 604 | |
| 605 base::FilePath GetPathForProfileType(ProfileType profile_type) { | |
| 606 switch (profile_type) { | |
| 607 case DEFAULT_THEME: | |
| 608 return default_profile_dir_.Get(); | |
| 609 case COMPLEX_THEME: | |
| 610 return complex_profile_dir_.Get(); | |
| 611 default: | |
| 612 NOTREACHED(); | |
| 613 return base::FilePath(); | |
| 614 } | |
| 615 } | |
| 616 | |
| 583 } // namespace perf_test | 617 } // namespace perf_test |
| OLD | NEW |