| 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..e1386ccffe0201333ef543febd8668d0093f67b2 100755
|
| --- a/tools/metrics/histograms/update_net_error_codes.py
|
| +++ b/tools/metrics/histograms/update_net_error_codes.py
|
| @@ -13,10 +13,11 @@ import os.path
|
| import re
|
| import sys
|
|
|
| -sys.path.append(os.path.join(os.path.dirname(__file__), '..', 'common'))
|
| -from update_histogram_enum import UpdateHistogramFromDict
|
| +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) # tools/metrics
|
| +from common import path_util
|
| +from histograms import update_histogram_enum
|
|
|
| -NET_ERROR_LIST_PATH = '../../../net/base/net_error_list.h'
|
| +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 +27,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 +38,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()
|
|
|