157e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander#!/usr/bin/env python 257e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# 357e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 457e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# 557e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# Use of this source code is governed by a BSD-style license 657e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# that can be found in the LICENSE file in the root of the source 757e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# tree. An additional intellectual property rights grant can be found 857e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# in the file PATENTS. All contributing project authors may 957e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander# be found in the AUTHORS file in the root of the source tree. 103bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org 113bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org# Copied from /src/chrome/test/pyautolib/pyauto_utils.py in Chromium. 123bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org 133bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.orgimport sys 143bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org 153bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.orgdef PrintPerfResult(graph_name, series_name, data_point, units, 163bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org show_on_waterfall=False): 173bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org """Prints a line to stdout that is specially formatted for the perf bots. 183bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org 193bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org Args: 203bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org graph_name: String name for the graph on which to plot the data. 213bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org series_name: String name for the series (line on the graph) associated with 223bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org the data. This is also the string displayed on the waterfall 233bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org if |show_on_waterfall| is True. 243bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org data_point: Numeric data value to plot on the graph for the current build. 253bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org This can be a single value or an array of values. If an array, 263bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org the graph will plot the average of the values, along with error 273bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org bars. 283bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org units: The string unit of measurement for the given |data_point|. 293bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org show_on_waterfall: Whether or not to display this result directly on the 303bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org buildbot waterfall itself (in the buildbot step running 313bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org this test on the waterfall page, not the stdio page). 323bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org """ 333bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org waterfall_indicator = ['', '*'][show_on_waterfall] 343bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org print '%sRESULT %s: %s= %s %s' % ( 353bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org waterfall_indicator, graph_name, series_name, 363bb42ef0d6fbdf04fc5609c4902072c82db3aee6phoglund@webrtc.org str(data_point).replace(' ', ''), units) 3757e5fd2e604ff7e60425c3f7654b40da03fc763cHenrik Kjellander sys.stdout.flush() 38