Index: tools/metrics/histograms/update_net_error_codes.py |
diff --git a/tools/metrics/histograms/update_net_error_codes.py b/tools/metrics/histograms/update_net_error_codes.py |
index 3659dd1afccfc7ad61b70a738ae0ad4359795592..37e532375975d644b15fa7f20e98c89589c365a2 100755 |
--- a/tools/metrics/histograms/update_net_error_codes.py |
+++ b/tools/metrics/histograms/update_net_error_codes.py |
@@ -14,9 +14,11 @@ import re |
import sys |
sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common')) |
-from update_histogram_enum import UpdateHistogramFromDict |
+import path_util |
-NET_ERROR_LIST_PATH = '../../../net/base/net_error_list.h' |
+import update_histogram_enum |
+ |
+NET_ERROR_LIST_PATH = 'net/base/net_error_list.h' |
POSITIVE_ERROR_REGEX = re.compile(r'^NET_ERROR\(([\w]+), -([0-9]+)\)') |
NEGATIVE_ERROR_REGEX = re.compile(r'^NET_ERROR\(([\w]+), (-[0-9]+)\)') |
@@ -26,7 +28,7 @@ def ReadNetErrorCodes(filename, error_regex): |
error code to error name. |
""" |
# Read the file as a list of lines |
- with open(filename) as f: |
+ with open(path_util.GetInputFile(filename)) as f: |
content = f.readlines() |
# Parse out lines that are net errors. |
@@ -37,21 +39,22 @@ def ReadNetErrorCodes(filename, error_regex): |
errors[int(m.group(2))] = m.group(1) |
return errors |
+ |
def main(): |
if len(sys.argv) > 1: |
print >>sys.stderr, 'No arguments expected!' |
sys.stderr.write(__doc__) |
sys.exit(1) |
- UpdateHistogramFromDict( |
- 'NetErrorCodes', |
- ReadNetErrorCodes(NET_ERROR_LIST_PATH, POSITIVE_ERROR_REGEX), |
- NET_ERROR_LIST_PATH) |
+ update_histogram_enum.UpdateHistogramFromDict( |
+ 'NetErrorCodes', |
+ ReadNetErrorCodes(NET_ERROR_LIST_PATH, POSITIVE_ERROR_REGEX), |
+ NET_ERROR_LIST_PATH) |
- UpdateHistogramFromDict( |
- 'CombinedHttpResponseAndNetErrorCode', |
- ReadNetErrorCodes(NET_ERROR_LIST_PATH, NEGATIVE_ERROR_REGEX), |
- NET_ERROR_LIST_PATH) |
+ update_histogram_enum.UpdateHistogramFromDict( |
+ 'CombinedHttpResponseAndNetErrorCode', |
+ ReadNetErrorCodes(NET_ERROR_LIST_PATH, NEGATIVE_ERROR_REGEX), |
+ NET_ERROR_LIST_PATH) |
if __name__ == '__main__': |
main() |