## -*- mode: python; coding: utf-8 -*-

include("netperf_definitions.inc")
DESCRIPTION="TCP upload - N streams w/ping"
DEFAULTS={'PLOT': 'totals'}

STREAMS=get_test_parameter('upload_streams')

DATA_SETS = o([
    ('TCP upload',
     {'command': find_netperf("TCP_STREAM", LENGTH, HOST),
      'delay': DELAY,
      'units': 'Mbits/s',
      'runner': 'netperf_demo',
      'duplicates': STREAMS}),
    ('TCP upload avg',
     {'apply_to': [glob("TCP upload*", exclude=["TCP upload sum"])],
      'units': 'Mbits/s',
      'runner': 'average',}),
    ('TCP upload sum',
     {'apply_to': [glob("TCP upload*", exclude=["TCP upload avg"])],
      'units': 'Mbits/s',
      'runner': 'sum',}),
    ('Ping (ms) ICMP',
     {'command': find_ping(IP_VERSION, STEP_SIZE, TOTAL_LENGTH, HOST),
      'units': 'ms',
      'runner': 'ping',}),
])


PLOTS = o([
    ('totals',
     {'description': 'Bandwidth and ping plot',
      'type': 'timeseries',
      'dual_axes': True,
      'series': [{'data': 'TCP upload sum',
                  'label': 'Upload'},
                 {'data': 'Ping (ms) ICMP',
                  'label': 'Ping (ms)',
                  'axis': 2}]}),
    ('upload',
     {'description': 'Upload bandwidth plot',
      'type': 'timeseries',
      'legend_title': 'TCP upload',
      'series': [{'data': glob('TCP upload*', exclude=['TCP upload sum', 'TCP upload avg']),
                  'label': 'BE'},
                 {'data': 'TCP upload avg',
                  'label': 'Avg',
                  'smoothing': 10,
                  'color': 'black',
                  'linewidth': 2}]}),
    ('upload_scaled',
     {'description': 'Upload bandwidth w/axes scaled to remove outliers',
      'parent': 'upload',
      'scaling': (5,95)}),
    ('ping',
     {'description': 'Ping plot',
      'type': 'timeseries',
      'axis_labels': ['Latency (ms)'],
      'series': [{'data': 'Ping (ms) ICMP',
                  'label': 'Ping (ms)'},]}),
    ('ping_smooth',
     {'description': 'Ping plot (inc smoothed average)',
      'type': 'timeseries',
      'legend_title': 'Ping (ms)',
      'axis_labels': ['Latency (ms)'],
      'series': [
                 {'data': 'Ping (ms) ICMP',
                  'label': 'Ping (ms)'},
                 {'data': 'Ping (ms) ICMP',
                  'label': 'Avg (smoothing)',
                  'smoothing': 5,
                  'color': 'black',
                  'linewidth': 2}]}),
    ('ping_cdf',
     {'description': 'Ping CDF plot',
      'type': 'cdf',
      'series': [{'data': 'Ping (ms) ICMP',
                  'label': 'Ping (ms)'},],
      'cutoff': (DELAY,DELAY)}),
    ('box_totals',
     {'description': 'Box plot of totals',
      'parent': 'totals',
      'type': 'box',}),
    ])


include("common.inc")
