• Home
  • Raw
  • Download

Lines Matching refs:engines

72 struct engines {  struct
126 #define engine_ptr(engines, n) (&engines->engine + (n)) argument
171 static struct engines *discover_engines(void) in discover_engines()
174 struct engines *engines; in discover_engines() local
179 engines = malloc(sizeof(struct engines)); in discover_engines()
180 if (!engines) in discover_engines()
183 memset(engines, 0, sizeof(*engines)); in discover_engines()
185 engines->num_engines = 0; in discover_engines()
195 engine_ptr(engines, engines->num_engines); in discover_engines()
254 engines->num_engines++; in discover_engines()
255 engines = realloc(engines, sizeof(struct engines) + in discover_engines()
256 engines->num_engines * sizeof(struct engine)); in discover_engines()
257 if (!engines) { in discover_engines()
266 free(engines); in discover_engines()
272 qsort(engine_ptr(engines, 0), engines->num_engines, in discover_engines()
275 engines->root = d; in discover_engines()
277 return engines; in discover_engines()
452 static int pmu_init(struct engines *engines) in pmu_init() argument
457 engines->fd = -1; in pmu_init()
458 engines->num_counters = 0; in pmu_init()
460 engines->irq.config = I915_PMU_INTERRUPTS; in pmu_init()
461 fd = _open_pmu(engines->num_counters, &engines->irq, engines->fd); in pmu_init()
465 engines->freq_req.config = I915_PMU_REQUESTED_FREQUENCY; in pmu_init()
466 _open_pmu(engines->num_counters, &engines->freq_req, engines->fd); in pmu_init()
468 engines->freq_act.config = I915_PMU_ACTUAL_FREQUENCY; in pmu_init()
469 _open_pmu(engines->num_counters, &engines->freq_act, engines->fd); in pmu_init()
471 engines->rc6.config = I915_PMU_RC6_RESIDENCY; in pmu_init()
472 _open_pmu(engines->num_counters, &engines->rc6, engines->fd); in pmu_init()
474 for (i = 0; i < engines->num_engines; i++) { in pmu_init()
475 struct engine *engine = engine_ptr(engines, i); in pmu_init()
489 get_pmu_config(dirfd(engines->root), in pmu_init()
492 fd = _open_pmu(engines->num_counters, cnt->pmu, in pmu_init()
493 engines->fd); in pmu_init()
499 engines->rapl_fd = -1; in pmu_init()
501 engines->rapl_scale = rapl_gpu_power_scale(); in pmu_init()
502 engines->rapl_unit = rapl_gpu_power_unit(); in pmu_init()
503 if (!engines->rapl_unit) in pmu_init()
506 engines->rapl.config = rapl_gpu_power(); in pmu_init()
507 if (!engines->rapl.config) in pmu_init()
510 engines->rapl_fd = igt_perf_open(rapl_type_id(), in pmu_init()
511 engines->rapl.config); in pmu_init()
512 if (engines->rapl_fd < 0) in pmu_init()
515 engines->rapl.present = true; in pmu_init()
518 engines->imc_fd = -1; in pmu_init()
522 engines->imc_reads_scale = imc_data_reads_scale(); in pmu_init()
523 engines->imc_writes_scale = imc_data_writes_scale(); in pmu_init()
525 engines->imc_reads_unit = imc_data_reads_unit(); in pmu_init()
526 if (!engines->imc_reads_unit) in pmu_init()
529 engines->imc_writes_unit = imc_data_writes_unit(); in pmu_init()
530 if (!engines->imc_writes_unit) in pmu_init()
533 engines->imc_reads.config = imc_data_reads(); in pmu_init()
534 if (!engines->imc_reads.config) in pmu_init()
537 engines->imc_writes.config = imc_data_writes(); in pmu_init()
538 if (!engines->imc_writes.config) in pmu_init()
541 fd = _open_imc(num, &engines->imc_reads, engines->imc_fd); in pmu_init()
544 fd = _open_imc(num, &engines->imc_writes, engines->imc_fd); in pmu_init()
548 engines->imc_reads.present = true; in pmu_init()
549 engines->imc_writes.present = true; in pmu_init()
628 static void pmu_sample(struct engines *engines) in pmu_sample() argument
630 const int num_val = engines->num_counters; in pmu_sample()
634 engines->ts.prev = engines->ts.cur; in pmu_sample()
636 if (engines->rapl_fd >= 0) in pmu_sample()
637 __update_sample(&engines->rapl, in pmu_sample()
638 pmu_read_single(engines->rapl_fd)); in pmu_sample()
640 if (engines->imc_fd >= 0) { in pmu_sample()
641 pmu_read_multi(engines->imc_fd, 2, val); in pmu_sample()
642 update_sample(&engines->imc_reads, val); in pmu_sample()
643 update_sample(&engines->imc_writes, val); in pmu_sample()
646 engines->ts.cur = pmu_read_multi(engines->fd, num_val, val); in pmu_sample()
648 update_sample(&engines->freq_req, val); in pmu_sample()
649 update_sample(&engines->freq_act, val); in pmu_sample()
650 update_sample(&engines->irq, val); in pmu_sample()
651 update_sample(&engines->rc6, val); in pmu_sample()
653 for (i = 0; i < engines->num_engines; i++) { in pmu_sample()
654 struct engine *engine = engine_ptr(engines, i); in pmu_sample()
1007 print_header(struct engines *engines, double t, in print_header() argument
1024 { &engines->freq_req, 4, 0, 1.0, t, 1, "requested", "req" }, in print_header()
1025 { &engines->freq_act, 4, 0, 1.0, t, 1, "actual", "act" }, in print_header()
1035 { &engines->irq, 8, 0, 1.0, t, 1, "count", "/s" }, in print_header()
1045 { &engines->rc6, 3, 0, 1e9, t, 100, "value", "%" }, in print_header()
1055 { &engines->rapl, 4, 2, 1.0, t, engines->rapl_scale, "value", in print_header()
1089 engines->rapl_unit, in print_header()
1100 print_imc(struct engines *engines, double t, int lines, int con_w, int con_h) in print_imc() argument
1103 { &engines->imc_reads, 6, 0, 1.0, t, engines->imc_reads_scale, in print_imc()
1105 { &engines->imc_writes, 6, 0, 1.0, t, engines->imc_writes_scale, in print_imc()
1121 engines->imc_reads_unit); in print_imc()
1125 engines->imc_reads_unit); in print_imc()
1136 imc_items[0].buf, engines->imc_reads_unit); in print_imc()
1140 imc_items[1].buf, engines->imc_writes_unit); in print_imc()
1150 print_engines_header(struct engines *engines, double t, in print_engines_header() argument
1154 i < engines->num_engines && lines < con_h; in print_engines_header()
1156 struct engine *engine = engine_ptr(engines, i); in print_engines_header()
1181 print_engine(struct engines *engines, unsigned int i, double t, in print_engine() argument
1184 struct engine *engine = engine_ptr(engines, i); in print_engine()
1231 print_engines_footer(struct engines *engines, double t, in print_engines_footer() argument
1257 struct engines *engines; in main() local
1323 engines = discover_engines(); in main()
1324 if (!engines) { in main()
1331 ret = pmu_init(engines); in main()
1338 pmu_sample(engines); in main()
1354 pmu_sample(engines); in main()
1355 t = (double)(engines->ts.cur - engines->ts.prev) / 1e9; in main()
1361 lines = print_header(engines, t, lines, con_w, con_h, in main()
1364 if (engines->imc_fd) in main()
1365 lines = print_imc(engines, t, lines, con_w, in main()
1368 lines = print_engines_header(engines, t, lines, con_w, in main()
1372 i < engines->num_engines && lines < con_h; in main()
1374 lines = print_engine(engines, i, t, lines, in main()
1377 lines = print_engines_footer(engines, t, lines, con_w, in main()