| OLD | NEW |
| 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // Part 1: Represent the overall operation being performed. | 26 // Part 1: Represent the overall operation being performed. |
| 27 const char kProcessFullUpdate[] = "SafeBrowsing.V4ProcessFullUpdate"; | 27 const char kProcessFullUpdate[] = "SafeBrowsing.V4ProcessFullUpdate"; |
| 28 const char kProcessPartialUpdate[] = "SafeBrowsing.V4ProcessPartialUpdate"; | 28 const char kProcessPartialUpdate[] = "SafeBrowsing.V4ProcessPartialUpdate"; |
| 29 const char kReadFromDisk[] = "SafeBrowsing.V4ReadFromDisk"; | 29 const char kReadFromDisk[] = "SafeBrowsing.V4ReadFromDisk"; |
| 30 // Part 2: Represent the sub-operation being performed as part of the larger | 30 // Part 2: Represent the sub-operation being performed as part of the larger |
| 31 // operation from part 1. | 31 // operation from part 1. |
| 32 const char kApplyUpdate[] = ".ApplyUpdate"; | 32 const char kApplyUpdate[] = ".ApplyUpdate"; |
| 33 const char kDecodeAdditions[] = ".DecodeAdditions"; | 33 const char kDecodeAdditions[] = ".DecodeAdditions"; |
| 34 const char kDecodeRemovals[] = ".DecodeRemovals"; | 34 const char kDecodeRemovals[] = ".DecodeRemovals"; |
| 35 const char kMergeUpdate[] = ".MergeUpdate"; | 35 const char kMergeUpdate[] = ".MergeUpdate"; |
| 36 // Part 3: Represent the unit of value being measured and logged. | 36 // Part 3 (optional): Represent the name of the list for which the metric is |
| 37 // being logged. For instance, ".UrlSoceng". |
| 38 // Part 4: Represent the unit of value being measured and logged. |
| 37 const char kResult[] = ".Result"; | 39 const char kResult[] = ".Result"; |
| 38 const char kTime[] = ".Time"; | 40 const char kTime[] = ".Time"; |
| 39 // UMA metric names for this file are generated by appending one value each, | 41 // UMA metric names for this file are generated by appending one value each, |
| 40 // in order, from parts 1, 2, and 3. | 42 // in order, from parts [1, 2, and 4], or [1, 2, 3, and 4]. For example: |
| 43 // SafeBrowsing.V4ProcessPartialUpdate.ApplyUpdate.Result, or |
| 44 // SafeBrowsing.V4ProcessPartialUpdate.ApplyUpdate.UrlSoceng.Result |
| 41 | 45 |
| 42 const uint32_t kFileMagic = 0x600D71FE; | 46 const uint32_t kFileMagic = 0x600D71FE; |
| 43 const uint32_t kFileVersion = 9; | 47 const uint32_t kFileVersion = 9; |
| 44 | 48 |
| 45 std::string GetUmaSuffixForStore(const base::FilePath& file_path) { | 49 std::string GetUmaSuffixForStore(const base::FilePath& file_path) { |
| 46 return base::StringPrintf( | 50 return base::StringPrintf( |
| 47 ".%" PRIsFP, file_path.BaseName().RemoveExtension().value().c_str()); | 51 ".%" PRIsFP, file_path.BaseName().RemoveExtension().value().c_str()); |
| 48 } | 52 } |
| 49 | 53 |
| 50 void RecordTimeWithAndWithoutSuffix(const std::string& metric, | 54 void RecordTimeWithAndWithoutSuffix(const std::string& metric, |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 << "; expected: " << expected_checksum_b64 | 808 << "; expected: " << expected_checksum_b64 |
| 805 << "; store: " << *this; | 809 << "; store: " << *this; |
| 806 #endif | 810 #endif |
| 807 return false; | 811 return false; |
| 808 } | 812 } |
| 809 } | 813 } |
| 810 return true; | 814 return true; |
| 811 } | 815 } |
| 812 | 816 |
| 813 } // namespace safe_browsing | 817 } // namespace safe_browsing |
| OLD | NEW |