コード例 #1
0
ファイル: wtstats.py プロジェクト: 3rf/mongo
def output_series(results, prefix=None, grouplist=[]):
    # open the output file based on prefix
    if prefix == None:
        outputname = args.output + '.html'
    elif len(grouplist) == 0:
        outputname = args.output +'.' + prefix + '.html'
    else:
        outputname = args.output +'.group.' + prefix + '.html'

    if prefix != None and len(grouplist) == 0:
        this_series = []
        for title, yaxis, ydata in results:
            if not prefix in title:
                continue
            #print 'Appending to dataset: ' + title
            this_series.append((title, yaxis, ydata))
    elif prefix != None and len(grouplist) > 0:
        this_series = []
        for title, yaxis, ydata in results:
            for subgroup in grouplist:
                if not subgroup in title:
                    continue
                # print 'Appending to dataset: ' + title
                this_series.append((title, yaxis, ydata))
    else:
        this_series = results

    if len(this_series) == 0:
        print 'Output: ' + outputname + ' has no data.  Do not create.'
        return

    #---------------------------------------
    if args.right:
            charttype = multiChart
    elif args.focus:
            charttype = lineWithFocusChart
    else:
            charttype = lineChart

    chart_extra = {}
    # Add in the x axis if the user wants time.
    if args.abstime:
            chart_extra['x_axis_format'] = '%H:%M:%S'

    # Create the chart, add the series
    chart = charttype(name='statlog', height=450+10*len(this_series), resize=True, x_is_date=args.abstime, y_axis_format='g', assets_directory='http://source.wiredtiger.com/graphs/', **chart_extra)

    for title, yaxis, ydata in this_series:
            chart.add_serie(x=xdata, y=(ydata.get(x, 0) for x in xdata), name=title,
                            type="line", yaxis="2" if yaxis else "1")

            if args.wtperf:
                    addPlotsToStatsChart(chart, os.path.dirname(args.files[0]), args.abstime)

    chart.buildhtml()
    output_file = open(outputname, 'w')
    output_file.write(chart.htmlcontent)

    #close Html file
    output_file.close()
コード例 #2
0
ファイル: wtstats.py プロジェクト: EaseTech/wiredtiger
# open the output file
output_file = open(args.output, 'w')
#---------------------------------------
if args.right:
    charttype = multiChart
elif args.focus:
    charttype = lineWithFocusChart
else:
    charttype = lineChart

chart_extra = {}
# Add in the x axis if the user wants time.
if args.abstime:
    chart_extra['x_axis_format'] = '%H:%M:%S'

# Create the chart, add the series
chart = charttype(name='statlog', height=450+10*len(results), resize=True, x_is_date=args.abstime, y_axis_format='g', assets_directory='http://source.wiredtiger.com/graphs/', **chart_extra)

for title, yaxis, ydata in results:
    chart.add_serie(x=xdata, y=(ydata.get(x, 0) for x in xdata), name=title,
                    type="line", yaxis="2" if yaxis else "1")

if args.wtperf:
    addPlotsToStatsChart(chart, os.path.dirname(args.files[0]), args.abstime)

chart.buildhtml()
output_file.write(chart.htmlcontent)

#close Html file
output_file.close()
コード例 #3
0
chart_extra = {}
# Add in the x axis if the user wants time.
if args.abstime:
    chart_extra['x_axis_format'] = '%H:%M:%S'

# Create the chart, add the series
chart = charttype(name='statlog',
                  height=450 + 10 * len(results),
                  resize=True,
                  x_is_date=args.abstime,
                  y_axis_format='g',
                  assets_directory='http://source.wiredtiger.com/graphs/',
                  **chart_extra)

for title, yaxis, ydata in results:
    chart.add_serie(x=xdata,
                    y=(ydata.get(x, 0) for x in xdata),
                    name=title,
                    type="line",
                    yaxis="2" if yaxis else "1")

if args.wtperf:
    addPlotsToStatsChart(chart, os.path.dirname(args.files[0]), args.abstime)

chart.buildhtml()
output_file.write(chart.htmlcontent)

#close Html file
output_file.close()