Improve the command line interface for perf dashboard upload.

This patch:
 - renames `perf_id` which really is bot name and ends up being the
   value for the "bot" field in the data being sent to `bot_name`.
 - adds an explicit `--upload` flag for perf test / benchmark runner
   (rather than making the upload call based on the collective presence
   of all optional upload parameters)

R=etiennej@chromium.org

Review URL: https://codereview.chromium.org/1420503007 .

Cr-Mirrored-From: https://github.com/domokit/mojo
Cr-Mirrored-Commit: ccaee11a5bfbed231753bc92e98cc2e5b1270a49
diff --git a/devtoolslib/perf_dashboard.py b/devtoolslib/perf_dashboard.py
index 71fd143..68d87a3 100644
--- a/devtoolslib/perf_dashboard.py
+++ b/devtoolslib/perf_dashboard.py
@@ -59,6 +59,10 @@
       'to upload the results to.')
 
   dashboard_group.add_argument(
+      '--upload', action='store_true',
+      help='Upload the results to performance dashboard. Further arguments '
+           'in this group are relevant only if --upload is passed.')
+  dashboard_group.add_argument(
       '--server-url',
       help='Url of the server instance to upload the results to. By default a '
            'local instance is assumed to be running on port 8080.')
@@ -67,9 +71,8 @@
       help='Buildbot master name, used to construct link to buildbot log by '
            'the dashboard, and also as the top-level category for the data.')
   dashboard_group.add_argument(
-      '--perf-id',
-      help='Used as the second-level category for the data, usually the '
-           'platform type.')
+      '--bot-name',
+      help='Used as the second-level category for the data.')
   dashboard_group.add_argument(
       '--test-name',
       help='Name of the test that the perf data was generated from.')
@@ -87,7 +90,7 @@
            'upload the data.')
 
 
-def upload_chart_data(master_name, perf_id, test_name, builder_name,
+def upload_chart_data(master_name, bot_name, test_name, builder_name,
                       build_number, revision, chart_data, point_id,
                       server_url=None, dry_run=False):
   """Uploads the provided chart data to an instance of performance dashboard.
@@ -128,7 +131,7 @@
   # Wrap the |chart_data| with meta data as required by the spec.
   formatted_data = {
       "master": master_name,
-      "bot": perf_id,
+      "bot": bot_name,
       "masterid": master_name,
       "buildername": builder_name,
       "buildnumber": build_number,
@@ -159,7 +162,7 @@
 
     dashboard_params = urllib.urlencode({
         "masters": master_name,
-        "bots": perf_id,
+        "bots": bot_name,
         "tests": test_name,
         "rev": point_id
     })