Lines Matching +full:max +full:- +full:len
1 # task-analyzer.py - comprehensive perf tasks analysis
2 # SPDX-License-Identifier: GPL-2.0
8 # perf record -e sched:sched_switch -a -- sleep 10
9 # perf script report task-analyzer
21 os.environ["PERF_EXEC_PATH"] + "/scripts/python/Perf-Trace-Util/lib/Perf/Trace"
39 LEN_SWITCHED_IN = len("9999999.999999999") # 17
40 LEN_SWITCHED_OUT = len("9999999.999999999") # 17
41 LEN_CPU = len("000")
42 LEN_PID = len("maxvalue") # 8
43 LEN_TID = len("maxvalue") # 8
44 LEN_COMM = len("max-comms-length") # 16
45 LEN_RUNTIME = len("999999.999") # 10
47 LEN_OUT_IN = len("99999999999.999") # 15
48 LEN_OUT_OUT = len("99999999999.999") # 15
49 LEN_IN_IN = len("99999999999.999") # 15
50 LEN_IN_OUT = len("99999999999.999") # 15
75 """user enforced no-color or if stdout is no tty we disable colors"""
93 "--time-limit",
97 " --time-limit 123.111:789.222(print all between 123.111 and 789.222)"
98 " --time-limit 123: (print all from 123)"
99 " --time-limit :456 (print all until incl. 456)",
102 "--summary", action="store_true", help="print addtional runtime information"
105 "--summary-only", action="store_true", help="print only summary without traces"
108 "--summary-extended",
110 help="print the summary with additional information of max inter task times"
114 "--ns", action="store_true", help="show timestamps in nanoseconds"
117 "--ms", action="store_true", help="show timestamps in milliseconds"
120 "--extended-times",
127 "--filter-tasks",
130 " E.g --filter-task 1337,/sbin/init ",
133 "--limit-to-tasks",
136 " E.g --limit-to-tasks 1337,/sbin/init",
139 "--highlight-tasks",
142 " E.g. --highlight-tasks 1:red,mutt:yellow"
146 "--rename-comms-by-tids",
150 " process. E.g --rename 1337:my-python-app",
153 "--stdio-color",
160 "--csv",
162 help="Write trace to file selected by user. Options, like --ns or --extended"
163 "-times are used.",
166 "--csv-summary",
168 help="Write summary to file selected by user. Options, like --ns or"
169 " --summary-extended are used.",
199 db["task_info"]["pid"] = len("PID")
200 db["task_info"]["tid"] = len("TID")
201 db["task_info"]["comm"] = len("Comm")
202 db["runtime_info"]["runs"] = len("Runs")
203 db["runtime_info"]["acc"] = len("Accumulated")
204 db["runtime_info"]["max"] = len("Max")
205 db["runtime_info"]["max_at"] = len("Max At")
206 db["runtime_info"]["min"] = len("Min")
207 db["runtime_info"]["mean"] = len("Mean")
208 db["runtime_info"]["median"] = len("Median")
211 db["inter_times"]["out_in"] = len("Out-In")
212 db["inter_times"]["inter_at"] = len("At")
213 db["inter_times"]["out_out"] = len("Out-Out")
214 db["inter_times"]["in_in"] = len("In-In")
215 db["inter_times"]["in_out"] = len("In-Out")
219 """phython3 hat statistics module - we have nothing"""
220 n = len(numbers)
224 return sum(sorted(numbers)[index - 1 : index + 1]) / 2
228 return sum(numbers) / len(numbers)
234 help of this class. There are 4 of those Timespans Out-Out, In-Out, Out-In and
235 In-In.
244 self.out_out = -1
245 self.in_out = -1
246 self.out_in = -1
247 self.in_in = -1
249 self._time_in = -1
250 self.max_out_in = -1
251 self.max_at = -1
252 self.max_in_out = -1
253 self.max_in_in = -1
254 self.max_out_out = -1
268 self.in_in = time_in - self._last_start
269 self.out_in = time_in - self._last_finish
270 self.in_out = time_out - self._last_start
271 self.out_out = time_out - self._last_finish
293 find and memorize relevant data such as mean, max et cetera. This instance handles
305 median, min, max, max_at): argument
314 self.max = max
332 sum(db["runtime_info"].values()) - 2 * decimal_precision
338 sum(db["inter_times"].values()) - 4 * decimal_precision
340 _header += ("Max Inter Task Times",)
346 is implemented depeding on the choice of the timeunit. The positions of the max
362 separator, (db["runtime_info"]["min"] - decimal_precision) * fix_csv_align
365 separator, (db["runtime_info"]["max"] - decimal_precision) * fix_csv_align
368 separator, (db["runtime_info"]["max_at"] - time_precision) * fix_csv_align
372 column_titles += ("Runs", "Accumulated", "Mean", "Median", "Min", "Max")
373 column_titles += (_COLORS["grey"], "Max At", _COLORS["reset"])
378 (db["inter_times"]["out_in"] - decimal_precision) * fix_csv_align
382 (db["inter_times"]["inter_at"] - time_precision) * fix_csv_align
386 (db["inter_times"]["out_out"] - decimal_precision) * fix_csv_align
390 (db["inter_times"]["in_in"] - decimal_precision) * fix_csv_align
394 (db["inter_times"]["in_out"] - decimal_precision) * fix_csv_align
397 column_titles += ("Out-In", _COLORS["grey"], "Max At", _COLORS["reset"],
398 "Out-Out", "In-In", "In-Out")
419 if len(runtimes) > 1:
422 time_max = max(runtimes)
424 max_at = time_in[runtimes.index(max(runtimes))]
439 self._body[-1].extend([timespans.max_out_in,
461 len_min = (db["runtime_info"]["min"] - decimal_precision) * fix_csv_align
462 len_max = (db["runtime_info"]["max"] - decimal_precision) * fix_csv_align
463 len_max_at = (db["runtime_info"]["max_at"] - time_precision) * fix_csv_align
466 db["inter_times"]["out_in"] - decimal_precision
469 db["inter_times"]["inter_at"] - time_precision
472 db["inter_times"]["out_out"] - decimal_precision
474 len_in_in = (db["inter_times"]["in_in"] - decimal_precision) * fix_csv_align
476 db["inter_times"]["in_out"] - decimal_precision
507 if len(str(getattr(align_helper, key))) > db["task_info"][key]:
508 db["task_info"][key] = len(str(getattr(align_helper, key)))
510 if len(str(getattr(align_helper, key))) > db["runtime_info"][key]:
511 db["runtime_info"][key] = len(str(getattr(align_helper, key)))
514 if len(str(getattr(align_helper, key))) > db["inter_times"][key]:
515 db["inter_times"][key] = len(str(getattr(align_helper, key)))
526 for i in range(len(self._body)):
563 return (self._time_out - self._time_in) * decimal.Decimal(factor)
570 """returns a "unique-enough" identifier, please do not change"""
571 return "{}-{}".format(pid, cpu)
629 header = ("Switched-In", "Switched-Out", "CPU", "PID", "TID", "Comm", "Runtime",
630 "Time Out-In")
632 header += ("Time Out-Out", "Time In-In", "Time In-Out")
641 out_in = -1
642 out_out = -1
643 in_in = -1
644 in_out = -1
654 # grey-out entries if PID == TID, they
664 last_tid_task = db["tid"][task.tid][-1]
693 no need to store more then one element if --summarize
696 if not args.summary and len(_list) > 1:
697 _list = _list[len(_list) - 1 :]
728 # event. Seen in combination with --exclude-perf
730 # switched in. Probably a bug in exclude-perf
760 # are switched-to again - saw this via --exclude-perf
806 sys.exit("Error: No file chosen to write summary to. Choose with --csv-summary "
809 sys.exit("Error: --csv chosen and --summary-only. Standard task would not be"
822 if len(tid_name) != 2:
829 if len(tasks_color_map) == 1:
836 if len(tasks_color_map) != 2:
929 # user specific --time-limit a:b set