Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1304)

Unified Diff: tools/telemetry/count

Issue 973893002: [telemetry] Add public module counter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/count
diff --git a/tools/telemetry/count b/tools/telemetry/count
new file mode 100755
index 0000000000000000000000000000000000000000..e4e7b0fdf31e3d7e855125f5d5936be2802b342d
--- /dev/null
+++ b/tools/telemetry/count
@@ -0,0 +1,42 @@
+#! /usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import imp
+import inspect
+import os
+
+from telemetry.util import path
+
+
+def IncludeDir(dir_name):
+ return (dir_name[0] != '.' and dir_name[0] != '_' and
+ not dir_name.startswith('internal') and not dir_name == 'third_party')
+
+
+def IncludeFile(file_name):
+ root, ext = os.path.splitext(file_name)
+ return (file_name[0] != '.' and
+ not root.endswith('_unittest') and ext == '.py')
+
+
+def ListFiles(directory):
+ matching_files = []
+ for root, dirs, files in os.walk(directory):
+ dirs[:] = [dir_name for dir_name in dirs if IncludeDir(dir_name)]
+ matching_files += [
+ os.path.relpath(os.path.join(root, file_name), directory)
+ for file_name in files if IncludeFile(file_name)]
+ return sorted(matching_files)
+
+
+def main():
+ modules = ListFiles(path.GetTelemetryDir())
+ for module in modules:
eakuefner 2015/03/03 23:58:17 TODO(dtu/eakuefner): add a -v option and re-enable
eakuefner 2015/03/04 00:00:47 Or don't.
dtu 2015/03/04 00:01:26 Done.
+ print module
+ print len(modules)
+
+
+if __name__ == '__main__':
+ main()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698