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

Side by Side Diff: tools/metrics/actions/extract_actions.py

Issue 23508003: Added UMA actions to devices page (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/metrics/actions/chromeactions.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Extract UserMetrics "actions" strings from the Chrome source. 7 """Extract UserMetrics "actions" strings from the Chrome source.
8 8
9 This program generates the list of known actions we expect to see in the 9 This program generates the list of known actions we expect to see in the
10 user behavior logs. It walks the Chrome source, looking for calls to 10 user behavior logs. It walks the Chrome source, looking for calls to
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 actions.add('HistoryPage_NewestHistoryClick') 538 actions.add('HistoryPage_NewestHistoryClick')
539 actions.add('HistoryPage_NewerHistoryClick') 539 actions.add('HistoryPage_NewerHistoryClick')
540 actions.add('HistoryPage_OlderHistoryClick') 540 actions.add('HistoryPage_OlderHistoryClick')
541 actions.add('HistoryPage_Search') 541 actions.add('HistoryPage_Search')
542 actions.add('HistoryPage_InitClearBrowsingData') 542 actions.add('HistoryPage_InitClearBrowsingData')
543 actions.add('HistoryPage_RemoveSelected') 543 actions.add('HistoryPage_RemoveSelected')
544 actions.add('HistoryPage_SearchResultRemove') 544 actions.add('HistoryPage_SearchResultRemove')
545 actions.add('HistoryPage_ConfirmRemoveSelected') 545 actions.add('HistoryPage_ConfirmRemoveSelected')
546 actions.add('HistoryPage_CancelRemoveSelected') 546 actions.add('HistoryPage_CancelRemoveSelected')
547 547
548 def AddDevicesPageActions(actions):
549 """Add actions that are used in Devices page.
550
551 Arguments
552 actions: set of actions to add to.
553 """
554 actions.add('DevicesPage_Opened')
555 actions.add('DevicesPage_AddPrintersClicked')
556 actions.add('DevicesPage_RegisterClicked')
557 actions.add('DevicesPage_RegisterCancel')
558 actions.add('DevicesPage_RegisterFailure')
559 actions.add('DevicesPage_RegisterSuccess')
560 actions.add('DevicesPage_ManageClicked')
561
548 def main(argv): 562 def main(argv):
549 if '--hash' in argv: 563 if '--hash' in argv:
550 hash_output = True 564 hash_output = True
551 else: 565 else:
552 hash_output = False 566 hash_output = False
553 print >>sys.stderr, "WARNING: If you added new UMA tags, you must" + \ 567 print >>sys.stderr, "WARNING: If you added new UMA tags, you must" + \
554 " use the --hash option to update chromeactions.txt." 568 " use the --hash option to update chromeactions.txt."
555 # if we do a hash output, we want to only append NEW actions, and we know 569 # if we do a hash output, we want to only append NEW actions, and we know
556 # the file we want to work on 570 # the file we want to work on
557 actions = set() 571 actions = set()
(...skipping 20 matching lines...) Expand all
578 592
579 # print "Scanned {0} number of files".format(number_of_files_total) 593 # print "Scanned {0} number of files".format(number_of_files_total)
580 # print "Found {0} entries".format(len(actions)) 594 # print "Found {0} entries".format(len(actions))
581 595
582 AddClosedSourceActions(actions) 596 AddClosedSourceActions(actions)
583 AddChromeOSActions(actions) 597 AddChromeOSActions(actions)
584 AddExtensionActions(actions) 598 AddExtensionActions(actions)
585 AddAndroidActions(actions) 599 AddAndroidActions(actions)
586 AddBookmarkManagerActions(actions) 600 AddBookmarkManagerActions(actions)
587 AddHistoryPageActions(actions) 601 AddHistoryPageActions(actions)
602 AddDevicesPageActions(actions)
Ilya Sherman 2013/09/06 00:53:32 nit: While you're here, let's alphabetize these ca
Vitaly Buka (NO REVIEWS) 2013/09/06 06:21:09 I'll enable CQ now as-is and if it's committed by
Noam Samuel 2013/09/06 22:03:58 Done.
588 603
589 if hash_output: 604 if hash_output:
590 f = open(chromeactions_path, "wb") 605 f = open(chromeactions_path, "wb")
591 606
592 607
593 # Print out the actions as a sorted list. 608 # Print out the actions as a sorted list.
594 for action in sorted(actions): 609 for action in sorted(actions):
595 if hash_output: 610 if hash_output:
596 hash = hashlib.md5() 611 hash = hashlib.md5()
597 hash.update(action) 612 hash.update(action)
598 print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) 613 print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action)
599 else: 614 else:
600 print action 615 print action
601 616
602 if hash_output: 617 if hash_output:
603 print "Done. Do not forget to add chromeactions.txt to your changelist" 618 print "Done. Do not forget to add chromeactions.txt to your changelist"
604 return 0 619 return 0
605 620
606 621
607 if '__main__' == __name__: 622 if '__main__' == __name__:
608 sys.exit(main(sys.argv)) 623 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « tools/metrics/actions/chromeactions.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698