def aggregate_multi_flow_results(results): if len(results) == 1: return results sample_result = results[0] sample_flow = sample_result.flow dummy_flow = Flow( type=sample_flow.type, generator=sample_flow.generator, generator_bind=sample_flow.generator_bind, generator_nic=sample_flow.generator_nic, receiver=sample_flow.receiver, receiver_bind=sample_flow.receiver_bind, receiver_nic=sample_flow.receiver_nic, receiver_port=None, msg_size=sample_flow.msg_size, duration=sample_flow.duration, parallel_streams=sample_flow.parallel_streams, cpupin=None, aggregated_flow=True, ) aggregated_result = AggregatedFlowMeasurementResults( sample_result.measurement, dummy_flow) nr_iterations = len(sample_result.individual_results) for i in range(nr_iterations): parallel_result = FlowMeasurementResults( measurement=sample_result.measurement, flow=dummy_flow) parallel_result.generator_results = ParallelPerfResult() parallel_result.generator_cpu_stats = ParallelPerfResult() parallel_result.receiver_results = ParallelPerfResult() parallel_result.receiver_cpu_stats = ParallelPerfResult() for result in results: flow_result = result.individual_results[i] parallel_result.generator_results.append( flow_result.generator_results) parallel_result.receiver_results.append( flow_result.receiver_results) parallel_result.generator_cpu_stats.append( flow_result.generator_cpu_stats) parallel_result.receiver_cpu_stats.append( flow_result.receiver_cpu_stats) aggregated_result.add_results(parallel_result) return [aggregated_result]
def _parse_job_samples(self, job: Job) ->\ Tuple[ParallelPerfResult, ParallelPerfResult]: """ each perfinterval is samples.csv line #2 (l2) - line #1 (l1) to get # transactions and duration timestamp is time of l1, but we need to convert it from CLOCK_MONOTONIC time to unix time. samples.csv looks like this: ``` tid,flow_id,time,transactions,utime,stime,maxrss,minflt,majflt,nvcsw,nivcsw,latency_min,latency_mean,latency_max,latency_stddev 0,0,1898645.747723502,1,0.000371,0.000000,1144,39,0,2,0,0.000000,0.000000,0.000000,-nan 0,0,1898647.747733162,59322,0.185458,0.241758,1144,43,0,59320,0,0.000000,0.000000,0.000000,0.000000 0,0,1898648.747757407,89210,0.281500,0.354934,1144,43,0,89207,0,0.000000,0.000000,0.000000,0.000000 0,0,1898649.747737156,118790,0.281500,0.354934,1144,43,0,89207,0,0.000000,0.000000,0.000000,0.000000 ``` :param job: :type job: :return: :rtype: """ results = SequentialPerfResult() cpu_results = SequentialPerfResult() if not job.passed: results.append(PerfInterval(0, 0, "transactions", time.time())) cpu_results.append(PerfInterval(0, 0, "cpu_percent", time.time())) elif job.what.is_crr_server(): # Neper doesn't support server stats for tcp_crr due to memory issues. # Use perf_interval of 0. # For duration neper doesn't have time_start/time_end for tcp_crr # So just use the value of test length d = float(job.what.params.test_length) results.append(PerfInterval(0, d, "transactions", time.time())) cpu_results.append(PerfInterval(0, d, "cpu_percent", time.time())) else: job_start = job.result['start_time'] samples = job.result['samples'] if samples is not None: neper_start_time = float(samples[0]['time']) for s_start, s_end in pairwise(samples): flow, cpu = get_interval(s_start, s_end, job_start, neper_start_time) results.append(flow) cpu_results.append(cpu) #Wrap in ParallelPerfResult for now for easier graphing #TODO When we add support for multiple flows and threads #We want to update this accordingly. p_results = ParallelPerfResult() p_results.append(results) p_cpu_results = ParallelPerfResult() p_cpu_results.append(cpu_results) return p_results, p_cpu_results
def _parse_job_streams(self, job): result = ParallelPerfResult() if not job.passed: result.append(PerfInterval(0, 0, "bits")) else: for i in job.result["data"]["end"]["streams"]: result.append(SequentialPerfResult()) for interval in job.result["data"]["intervals"]: for i, stream in enumerate(interval["streams"]): result[i].append( PerfInterval(stream["bytes"] * 8, stream["seconds"], "bits")) return result
def _parse_job_streams(self, job): result = ParallelPerfResult() if not job.passed: result.append(PerfInterval(0, 0, "bits", time.time())) else: for i in job.result["data"]["end"]["streams"]: result.append(SequentialPerfResult()) job_start = job.result["data"]["start"]["timestamp"]["timesecs"] for interval in job.result["data"]["intervals"]: interval_start = interval["sum"]["start"] for i, stream in enumerate(interval["streams"]): result[i].append(PerfInterval(stream["bytes"] * 8, stream["seconds"], "bits", job_start + interval_start)) return result
ParallelPerfResult( ParallelPerfResult( SequentialPerfResult([ PerfInterval(value=8708503410.285599, duration=1.0004048347473145, unit="bits", timestamp=1642059692), PerfInterval(value=8714238798.109116, duration=1.000683069229126, unit="bits", timestamp=1642059693.000405), PerfInterval(value=8695993478.856504, duration=0.9989690780639648, unit="bits", timestamp=1642059694.001088), PerfInterval(value=8719970801.200619, duration=1.000675916671753, unit="bits", timestamp=1642059695.000057), PerfInterval(value=8682960442.327856, duration=0.9997539520263672, unit="bits", timestamp=1642059696.000733), PerfInterval(value=8639173440.0, duration=0.9995779991149902, unit="bits", timestamp=1642059697.000487), PerfInterval(value=8602684352.765568, duration=0.9999890327453613, unit="bits", timestamp=1642059698.000065), PerfInterval(value=8604246655.244764, duration=1.0009279251098633, unit="bits", timestamp=1642059699.000054), PerfInterval(value=8689737600.0, duration=0.9991040229797363, unit="bits", timestamp=1642059700.000982), PerfInterval(value=8655333119.999998, duration=0.9999740123748779, unit="bits", timestamp=1642059701.000086), PerfInterval(value=8727269760.0, duration=1.0012290477752686, unit="bits", timestamp=1642059702.00006), PerfInterval(value=8692866316.52941, duration=0.9997501373291016, unit="bits", timestamp=1642059703.001289), PerfInterval(value=8661589513.554712, duration=0.9990200996398926, unit="bits", timestamp=1642059704.001039), PerfInterval(value=8663151803.620401, duration=0.9999699592590332, unit="bits", timestamp=1642059705.000059), PerfInterval(value=8713196238.173647, duration=1.0005011558532715, unit="bits", timestamp=1642059706.000029), PerfInterval(value=8701205760.0, duration=1.000087022781372, unit="bits", timestamp=1642059707.00053), PerfInterval(value=8706418560.0, duration=0.9995579719543457, unit="bits", timestamp=1642059708.000617), PerfInterval(value=8586001856.349964, duration=0.9998838901519775, unit="bits", timestamp=1642059709.000175), PerfInterval(value=8552639941.408288, duration=1.0009448528289795, unit="bits", timestamp=1642059710.000059), PerfInterval(value=8709024960.0, duration=0.9993410110473633, unit="bits", timestamp=1642059711.001004), PerfInterval(value=8723098481.907879, duration=1.0017168521881104, unit="bits", timestamp=1642059712.000345), PerfInterval(value=8408901760.0, duration=0.9994029998779297, unit="bits", timestamp=1642059713.002062), PerfInterval(value=8544165890.720863, duration=0.999985933303833, unit="bits", timestamp=1642059714.001465), PerfInterval(value=8684290763.1963, duration=1.0000500679016113, unit="bits", timestamp=1642059715.001451), PerfInterval(value=8709780273.736055, duration=1.0000219345092773, unit="bits", timestamp=1642059716.001501), PerfInterval(value=8692865798.808567, duration=0.9987020492553711, unit="bits", timestamp=1642059717.001523), PerfInterval(value=8694951435.402685, duration=1.0010781288146973, unit="bits", timestamp=1642059718.000225), PerfInterval(value=8709545202.240353, duration=1.0004808902740479, unit="bits", timestamp=1642059719.001303), PerfInterval(value=8702249358.102018, duration=0.9993131160736084, unit="bits", timestamp=1642059720.001784), PerfInterval(value=8673057673.788025, duration=1.0001170635223389, unit="bits", timestamp=1642059721.001097), PerfInterval(value=8611545086.593794, duration=0.999769926071167, unit="bits", timestamp=1642059722.001214), PerfInterval(value=8541172800.0, duration=1.0000920295715332, unit="bits", timestamp=1642059723.000984), PerfInterval(value=8607376387.123661, duration=0.9989831447601318, unit="bits", timestamp=1642059724.001076), PerfInterval(value=8503914816.0, duration=1.0019910335540771, unit="bits", timestamp=1642059725.000059), PerfInterval(value=8612615232.0, duration=0.999629020690918, unit="bits", timestamp=1642059726.00205), PerfInterval(value=8675361792.0, duration=1.0000829696655273, unit="bits", timestamp=1642059727.001679), PerfInterval(value=8683481204.019453, duration=0.9991998672485352, unit="bits", timestamp=1642059728.001762), PerfInterval(value=8674620997.51447, duration=0.9990980625152588, unit="bits", timestamp=1642059729.000962), PerfInterval(value=8713715441.808777, duration=1.0005438327789307, unit="bits", timestamp=1642059730.00006), PerfInterval(value=8679311482.391106, duration=0.9994559288024902, unit="bits", timestamp=1642059731.000604), PerfInterval(value=8648035200.0, duration=1.0011420249938965, unit="bits", timestamp=1642059732.00006), PerfInterval(value=8683482240.0, duration=1.0001649856567383, unit="bits", timestamp=1642059733.001202), PerfInterval(value=8378012160.0, duration=0.9986929893493652, unit="bits", timestamp=1642059734.001367), PerfInterval(value=8547950458.776982, duration=1.0002140998840332, unit="bits", timestamp=1642059735.00006), PerfInterval(value=8685567360.0, duration=1.000385046005249, unit="bits", timestamp=1642059736.000274), PerfInterval(value=8677749194.726856, duration=0.9997501373291016, unit="bits", timestamp=1642059737.000659), PerfInterval(value=8703813196.750051, duration=1.0007960796356201, unit="bits", timestamp=1642059738.000409), PerfInterval(value=8627184000.0, duration=1.0008490085601807, unit="bits", timestamp=1642059739.001205), PerfInterval(value=8692865280.0, duration=0.9993150234222412, unit="bits", timestamp=1642059740.002054), PerfInterval(value=8642822915.827566, duration=0.9986910820007324, unit="bits", timestamp=1642059741.001369), PerfInterval(value=8703185842.501377, duration=1.0000019073486328, unit="bits", timestamp=1642059742.00006), PerfInterval(value=8677852160.0, duration=1.0011889934539795, unit="bits", timestamp=1642059743.000062), PerfInterval(value=8690779123.911945, duration=0.9999358654022217, unit="bits", timestamp=1642059744.001251), PerfInterval(value=8685046080.0, duration=1.0002319812774658, unit="bits", timestamp=1642059745.001187), PerfInterval(value=8578704960.0, duration=0.9987289905548096, unit="bits", timestamp=1642059746.001419), PerfInterval(value=8679577152.0, duration=1.0011160373687744, unit="bits", timestamp=1642059747.000148), PerfInterval(value=8703026247.286531, duration=0.9989490509033203, unit="bits", timestamp=1642059748.001264), PerfInterval(value=8695992960.0, duration=0.9998459815979004, unit="bits", timestamp=1642059749.000213), PerfInterval(value=8711631360.0, duration=1.0000200271606445, unit="bits", timestamp=1642059750.000059), PerfInterval(value=8694429120.0, duration=1.000627040863037, unit="bits", timestamp=1642059751.000079), ]))))
def utilization(self): return ParallelPerfResult([self._data["user"], self._data["nice"], self._data["system"], self._data["irq"], self._data["softirq"], self._data["steal"]])