Lines Matching +full:8 +full:- +full:cpu
1 // SPDX-License-Identifier: GPL-2.0-only
3 * svghelper.c - helper functions for outputting svg
44 static double cpu2slot(int cpu) in cpu2slot() argument
46 return 2 * cpu + 1; in cpu2slot()
51 static double cpu2y(int cpu) in cpu2y() argument
54 return cpu2slot(topology_map[cpu]) * SLOT_MULT; in cpu2y()
56 return cpu2slot(cpu) * SLOT_MULT; in cpu2y()
63 X = 1.0 * svg_page_width * (__time - first_time) / (last_time - first_time); in time2pixels()
78 while (loop--) { in round_text_size()
103 new_width = (last_time - first_time) / 5000000; in open_svg()
115 fprintf(svgfile, " rect { stroke-width: 1; }\n"); in open_svg()
116 …fprintf(svgfile, " rect.process { fill:rgb(180,180,180); fill-opacity:0.9; stroke-width:1; … in open_svg()
117 …fprintf(svgfile, " rect.process2 { fill:rgb(180,180,180); fill-opacity:0.9; stroke-width:0; … in open_svg()
118 …fprintf(svgfile, " rect.process3 { fill:rgb(180,180,180); fill-opacity:0.5; stroke-width:0; … in open_svg()
119 …fprintf(svgfile, " rect.sample { fill:rgb( 0, 0,255); fill-opacity:0.8; stroke-width:0; … in open_svg()
120 …fprintf(svgfile, " rect.sample_hi{ fill:rgb(255,128, 0); fill-opacity:0.8; stroke-width:0; … in open_svg()
121 …fprintf(svgfile, " rect.error { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; … in open_svg()
122 …fprintf(svgfile, " rect.net { fill:rgb( 0,128, 0); fill-opacity:0.5; stroke-width:0; … in open_svg()
123 …fprintf(svgfile, " rect.disk { fill:rgb( 0, 0,255); fill-opacity:0.5; stroke-width:0; … in open_svg()
124 …fprintf(svgfile, " rect.sync { fill:rgb(128,128, 0); fill-opacity:0.5; stroke-width:0; … in open_svg()
125 …fprintf(svgfile, " rect.poll { fill:rgb( 0,128,128); fill-opacity:0.2; stroke-width:0; … in open_svg()
126 …fprintf(svgfile, " rect.blocked { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; … in open_svg()
127 …fprintf(svgfile, " rect.waiting { fill:rgb(224,214, 0); fill-opacity:0.8; stroke-width:0; … in open_svg()
128 …fprintf(svgfile, " rect.WAITING { fill:rgb(255,214, 48); fill-opacity:0.6; stroke-width:0; … in open_svg()
129 …fprintf(svgfile, " rect.cpu { fill:rgb(192,192,192); fill-opacity:0.2; stroke-width:0.5;… in open_svg()
130 …fprintf(svgfile, " rect.pstate { fill:rgb(128,128,128); fill-opacity:0.8; stroke-width:0; }… in open_svg()
131 …fprintf(svgfile, " rect.c1 { fill:rgb(255,214,214); fill-opacity:0.5; stroke-width:0; }… in open_svg()
132 …fprintf(svgfile, " rect.c2 { fill:rgb(255,172,172); fill-opacity:0.5; stroke-width:0; }… in open_svg()
133 …fprintf(svgfile, " rect.c3 { fill:rgb(255,130,130); fill-opacity:0.5; stroke-width:0; }… in open_svg()
134 …fprintf(svgfile, " rect.c4 { fill:rgb(255, 88, 88); fill-opacity:0.5; stroke-width:0; }… in open_svg()
135 …fprintf(svgfile, " rect.c5 { fill:rgb(255, 44, 44); fill-opacity:0.5; stroke-width:0; }… in open_svg()
136 …fprintf(svgfile, " rect.c6 { fill:rgb(255, 0, 0); fill-opacity:0.5; stroke-width:0; }… in open_svg()
137 …fprintf(svgfile, " line.pstate { stroke:rgb(255,255, 0); stroke-opacity:0.8; stroke-width:… in open_svg()
156 double w = time2pixels(end) - time2pixels(start); in svg_ubox()
164 fprintf(svgfile, "<rect x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\" class=\"%s\"/>\n", in svg_ubox()
175 double w = time2pixels(end) - time2pixels(start); in svg_lbox()
183 fprintf(svgfile, "<rect x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\" class=\"%s\"/>\n", in svg_lbox()
186 Yslot * SLOT_MULT + SLOT_HEIGHT - SLOT_HALF * height, in svg_lbox()
194 double w = time2pixels(end) - time2pixels(start); in svg_fbox()
202 fprintf(svgfile, "<rect x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\" class=\"%s\"/>\n", in svg_fbox()
205 Yslot * SLOT_MULT + SLOT_HEIGHT - SLOT_HEIGHT * height, in svg_fbox()
216 fprintf(svgfile, "<rect x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\" class=\"%s\"/>\n", in svg_box()
217 time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, type); in svg_box()
221 void svg_blocked(int Yslot, int cpu, u64 start, u64 end, const char *backtrace) in svg_blocked() argument
227 fprintf(svgfile, "<title>#%d blocked %s</title>\n", cpu, in svg_blocked()
228 time_to_string(end - start)); in svg_blocked()
235 void svg_running(int Yslot, int cpu, u64 start, u64 end, const char *backtrace) in svg_running() argument
243 if (svg_highlight && end - start > svg_highlight) in svg_running()
250 cpu, time_to_string(end - start)); in svg_running()
253 fprintf(svgfile, "<rect x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\" class=\"%s\"/>\n", in svg_running()
254 time2pixels(start), time2pixels(end)-time2pixels(start), Yslot * SLOT_MULT, SLOT_HEIGHT, in svg_running()
257 text_size = (time2pixels(end)-time2pixels(start)); in svg_running()
258 if (cpu > 9) in svg_running()
265 fprintf(svgfile, "<text x=\"%.8f\" y=\"%.8f\" font-size=\"%.8fpt\">%i</text>\n", in svg_running()
266 time2pixels(start), Yslot * SLOT_MULT + SLOT_HEIGHT - 1, text_size, cpu + 1); in svg_running()
289 void svg_waiting(int Yslot, int cpu, u64 start, u64 end, const char *backtrace) in svg_waiting() argument
300 if (end-start > 10 * NSEC_PER_MSEC) /* 10 msec */ in svg_waiting()
303 text = time_to_string(end-start); in svg_waiting()
305 font_size = 1.0 * (time2pixels(end)-time2pixels(start)); in svg_waiting()
312 …fprintf(svgfile, "<g transform=\"translate(%.8f,%.8f)\">\n", time2pixels(start), Yslot * SLOT_MULT… in svg_waiting()
313 fprintf(svgfile, "<title>#%d waiting %s</title>\n", cpu, time_to_string(end - start)); in svg_waiting()
316 fprintf(svgfile, "<rect x=\"0\" width=\"%.8f\" y=\"0\" height=\"%.1f\" class=\"%s\"/>\n", in svg_waiting()
317 time2pixels(end)-time2pixels(start), SLOT_HEIGHT, style); in svg_waiting()
319 fprintf(svgfile, "<text transform=\"rotate(90)\" font-size=\"%.8fpt\"> %s</text>\n", in svg_waiting()
331 /* CPU type */ in cpu_model()
343 /* CPU type */ in cpu_model()
344 file = fopen("/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies", "r"); in cpu_model()
357 void svg_cpu_box(int cpu, u64 __max_freq, u64 __turbo_freq) in svg_cpu_box() argument
368 fprintf(svgfile, "<rect x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\" class=\"cpu\"/>\n", in svg_cpu_box()
370 time2pixels(last_time)-time2pixels(first_time), in svg_cpu_box()
371 cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT); in svg_cpu_box()
373 sprintf(cpu_string, "CPU %i", (int)cpu); in svg_cpu_box()
374 fprintf(svgfile, "<text x=\"%.8f\" y=\"%.8f\">%s</text>\n", in svg_cpu_box()
375 10+time2pixels(first_time), cpu2y(cpu) + SLOT_HEIGHT/2, cpu_string); in svg_cpu_box()
377 fprintf(svgfile, "<text transform=\"translate(%.8f,%.8f)\" font-size=\"1.25pt\">%s</text>\n", in svg_cpu_box()
378 10+time2pixels(first_time), cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - 4, cpu_model()); in svg_cpu_box()
383 void svg_process(int cpu, u64 start, u64 end, int pid, const char *name, const char *backtrace) in svg_process() argument
391 if (svg_highlight && end - start >= svg_highlight) in svg_process()
398 fprintf(svgfile, "<g transform=\"translate(%.8f,%.8f)\">\n", time2pixels(start), cpu2y(cpu)); in svg_process()
399 fprintf(svgfile, "<title>%d %s running %s</title>\n", pid, name, time_to_string(end - start)); in svg_process()
402 fprintf(svgfile, "<rect x=\"0\" width=\"%.8f\" y=\"0\" height=\"%.1f\" class=\"%s\"/>\n", in svg_process()
403 time2pixels(end)-time2pixels(start), SLOT_MULT+SLOT_HEIGHT, type); in svg_process()
404 width = time2pixels(end)-time2pixels(start); in svg_process()
411 fprintf(svgfile, "<text transform=\"rotate(90)\" font-size=\"%.8fpt\">%s</text>\n", in svg_process()
417 void svg_cstate(int cpu, u64 start, u64 end, int type) in svg_cstate() argument
432 fprintf(svgfile, "<rect class=\"%s\" x=\"%.8f\" width=\"%.8f\" y=\"%.1f\" height=\"%.1f\"/>\n", in svg_cstate()
434 time2pixels(start), time2pixels(end)-time2pixels(start), in svg_cstate()
435 cpu2y(cpu), SLOT_MULT+SLOT_HEIGHT); in svg_cstate()
437 width = (time2pixels(end)-time2pixels(start))/2.0; in svg_cstate()
444 fprintf(svgfile, "<text x=\"%.8f\" y=\"%.8f\" font-size=\"%.8fpt\">C%i</text>\n", in svg_cstate()
445 time2pixels(start), cpu2y(cpu)+width, width, type); in svg_cstate()
474 void svg_pstate(int cpu, u64 start, u64 end, u64 freq) in svg_pstate() argument
485 height = 1 + cpu2y(cpu) + SLOT_MULT + SLOT_HEIGHT - height; in svg_pstate()
486 fprintf(svgfile, "<line x1=\"%.8f\" x2=\"%.8f\" y1=\"%.1f\" y2=\"%.1f\" class=\"pstate\"/>\n", in svg_pstate()
488 fprintf(svgfile, "<text x=\"%.8f\" y=\"%.8f\" font-size=\"0.25pt\">%s</text>\n", in svg_pstate()
514 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%.2f\" style=\"stroke:rgb(32,255,… in svg_partial_wakeline()
517 …fprintf(svgfile, "<g transform=\"translate(%.8f,%.8f)\"><text transform=\"rotate(90)\" font-size=\… in svg_partial_wakeline()
521 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%.2f\" style=\"stroke:rgb(32,255,… in svg_partial_wakeline()
522 time2pixels(start), row2 * SLOT_MULT - SLOT_MULT/32, time2pixels(start), row2 * SLOT_MULT); in svg_partial_wakeline()
524 …fprintf(svgfile, "<g transform=\"translate(%.8f,%.8f)\"><text transform=\"rotate(90)\" font-size=\… in svg_partial_wakeline()
525 time2pixels(start), row2 * SLOT_MULT - SLOT_MULT/32, desc1); in svg_partial_wakeline()
529 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%.2f\" style=\"stroke:rgb(32,255,… in svg_partial_wakeline()
532 …fprintf(svgfile, "<g transform=\"translate(%.8f,%.8f)\"><text transform=\"rotate(90)\" font-size=\… in svg_partial_wakeline()
536 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%.2f\" style=\"stroke:rgb(32,255,… in svg_partial_wakeline()
537 time2pixels(start), row1 * SLOT_MULT - SLOT_MULT/32, time2pixels(start), row1 * SLOT_MULT); in svg_partial_wakeline()
539 …fprintf(svgfile, "<g transform=\"translate(%.8f,%.8f)\"><text transform=\"rotate(90)\" font-size=\… in svg_partial_wakeline()
540 time2pixels(start), row1 * SLOT_MULT - SLOT_HEIGHT/32, desc2); in svg_partial_wakeline()
547 …fprintf(svgfile, "<circle cx=\"%.8f\" cy=\"%.2f\" r = \"0.01\" style=\"fill:rgb(32,255,32)\"/>\n… in svg_partial_wakeline()
567 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%.2f\" style=\"stroke:rgb(32,255,… in svg_wakeline()
570 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%.2f\" style=\"stroke:rgb(32,255,… in svg_wakeline()
576 …fprintf(svgfile, "<circle cx=\"%.8f\" cy=\"%.2f\" r = \"0.01\" style=\"fill:rgb(32,255,32)\"/>\n… in svg_wakeline()
594 …fprintf(svgfile, "<circle cx=\"%.8f\" cy=\"%.2f\" r = \"0.01\" style=\"fill:rgb(255,128,128)\"/>… in svg_interrupt()
596 …fprintf(svgfile, "<circle cx=\"%.8f\" cy=\"%.2f\" r = \"0.01\" style=\"fill:rgb(255,128,128)\"/>… in svg_interrupt()
607 fprintf(svgfile, "<text x=\"%.8f\" y=\"%.8f\">%s</text>\n", in svg_text()
616 fprintf(svgfile, "<rect x=\"%i\" width=\"%.8f\" y=\"0\" height=\"%.1f\" class=\"%s\"/>\n", in svg_legenda_box()
618 fprintf(svgfile, "<text transform=\"translate(%.8f, %.8f)\" font-size=\"%.8fpt\">%s</text>\n", in svg_legenda_box()
647 svg_legenda_box(650, "Waiting for cpu", "waiting"); in svg_legenda()
673 …fprintf(svgfile, "<line x1=\"%.8f\" y1=\"%.2f\" x2=\"%.8f\" y2=\"%" PRIu64 "\" style=\"stroke:rgb(… in svg_time_grid()
690 #define cpumask_bits(maskp) ((maskp)->bits)
700 static void scan_thread_topology(int *map, struct topology *t, int cpu, in scan_thread_topology() argument
706 for (i = 0; i < t->sib_thr_nr; i++) { in scan_thread_topology()
707 if (!test_bit(cpu, cpumask_bits(&t->sib_thr[i]))) in scan_thread_topology()
710 for_each_set_bit(thr, cpumask_bits(&t->sib_thr[i]), nr_cpus) in scan_thread_topology()
711 if (map[thr] == -1) in scan_thread_topology()
720 int cpu; in scan_core_topology() local
722 for (i = 0; i < t->sib_core_nr; i++) in scan_core_topology()
723 for_each_set_bit(cpu, cpumask_bits(&t->sib_core[i]), nr_cpus) in scan_core_topology()
724 scan_thread_topology(map, t, cpu, &pos, nr_cpus); in scan_core_topology()
731 struct perf_cpu cpu; in str_to_bitmap() local
735 return -1; in str_to_bitmap()
737 perf_cpu_map__for_each_cpu(cpu, idx, map) { in str_to_bitmap()
738 if (cpu.cpu >= nr_cpus) { in str_to_bitmap()
739 ret = -1; in str_to_bitmap()
743 __set_bit(cpu.cpu, cpumask_bits(b)); in str_to_bitmap()
756 int ret = -1; in svg_build_topology_map()
758 nr_cpus = min(env->nr_cpus_online, MAX_NR_CPUS); in svg_build_topology_map()
760 t.sib_core_nr = env->nr_sibling_cores; in svg_build_topology_map()
761 t.sib_thr_nr = env->nr_sibling_threads; in svg_build_topology_map()
762 t.sib_core = calloc(env->nr_sibling_cores, sizeof(cpumask_t)); in svg_build_topology_map()
763 t.sib_thr = calloc(env->nr_sibling_threads, sizeof(cpumask_t)); in svg_build_topology_map()
765 sib_core = env->sibling_cores; in svg_build_topology_map()
766 sib_thr = env->sibling_threads; in svg_build_topology_map()
773 for (i = 0; i < env->nr_sibling_cores; i++) { in svg_build_topology_map()
782 for (i = 0; i < env->nr_sibling_threads; i++) { in svg_build_topology_map()
798 topology_map[i] = -1; in svg_build_topology_map()