1 // SPDX-License-Identifier: GPL-2.0
3 * Intel dynamic_speed_select -- Enumerate and control features
4 * Copyright (c) 2019 Intel Corporation.
9 static void printcpulist(int str_len
, char *str
, int mask_size
,
12 int i
, first
, curr_index
, index
;
14 if (!CPU_COUNT_S(mask_size
, cpu_mask
)) {
15 snprintf(str
, str_len
, "none");
21 for (i
= 0; i
< get_topo_max_cpus(); ++i
) {
22 if (!CPU_ISSET_S(i
, mask_size
, cpu_mask
))
25 index
= snprintf(&str
[curr_index
],
26 str_len
- curr_index
, ",");
29 index
= snprintf(&str
[curr_index
], str_len
- curr_index
, "%d",
36 static void printcpumask(int str_len
, char *str
, int mask_size
,
39 int i
, max_cpus
= get_topo_max_cpus();
41 int size
, index
, curr_index
;
43 size
= max_cpus
/ (sizeof(unsigned int) * 8);
44 if (max_cpus
% (sizeof(unsigned int) * 8))
47 mask
= calloc(size
, sizeof(unsigned int));
51 for (i
= 0; i
< max_cpus
; ++i
) {
52 int mask_index
, bit_index
;
54 if (!CPU_ISSET_S(i
, mask_size
, cpu_mask
))
57 mask_index
= i
/ (sizeof(unsigned int) * 8);
58 bit_index
= i
% (sizeof(unsigned int) * 8);
59 mask
[mask_index
] |= BIT(bit_index
);
63 for (i
= size
- 1; i
>= 0; --i
) {
64 index
= snprintf(&str
[curr_index
], str_len
- curr_index
, "%08x",
68 strncat(&str
[curr_index
], ",", str_len
- curr_index
);
76 static void format_and_print_txt(FILE *outf
, int level
, char *header
,
80 static char delimiters
[256];
87 strcpy(delimiters
, " ");
89 for (i
= 0; i
< level
- 1; ++i
)
90 j
+= snprintf(&delimiters
[j
], sizeof(delimiters
) - j
,
94 if (header
&& value
) {
95 fprintf(outf
, "%s", delimiters
);
96 fprintf(outf
, "%s:%s\n", header
, value
);
98 fprintf(outf
, "%s", delimiters
);
99 fprintf(outf
, "%s\n", header
);
103 static int last_level
;
104 static void format_and_print(FILE *outf
, int level
, char *header
, char *value
)
107 static char delimiters
[256];
110 if (!out_format_is_json()) {
111 format_and_print_txt(outf
, level
, header
, value
);
119 fprintf(outf
, "\n}\n");
124 for (i
= 0; i
< level
; ++i
)
125 j
+= snprintf(&delimiters
[j
], sizeof(delimiters
) - j
,
128 if (last_level
== level
)
129 fprintf(outf
, ",\n");
132 if (last_level
!= level
)
135 fprintf(outf
, "%s\"%s\": ", delimiters
, header
);
136 fprintf(outf
, "\"%s\"", value
);
138 for (i
= last_level
- 1; i
>= level
; --i
) {
141 for (j
= i
; j
> 0; --j
)
142 k
+= snprintf(&delimiters
[k
],
143 sizeof(delimiters
) - k
,
145 if (i
== level
&& header
)
146 fprintf(outf
, "\n%s},", delimiters
);
148 fprintf(outf
, "\n%s}", delimiters
);
150 if (abs(last_level
- level
) < 3)
153 fprintf(outf
, "%s\"%s\": {", delimiters
,
161 static int print_package_info(int cpu
, FILE *outf
)
165 if (out_format_is_json()) {
166 snprintf(header
, sizeof(header
), "package-%d:die-%d:cpu-%d",
167 get_physical_package_id(cpu
), get_physical_die_id(cpu
),
169 format_and_print(outf
, 1, header
, NULL
);
172 snprintf(header
, sizeof(header
), "package-%d",
173 get_physical_package_id(cpu
));
174 format_and_print(outf
, 1, header
, NULL
);
175 snprintf(header
, sizeof(header
), "die-%d", get_physical_die_id(cpu
));
176 format_and_print(outf
, 2, header
, NULL
);
177 snprintf(header
, sizeof(header
), "cpu-%d", cpu
);
178 format_and_print(outf
, 3, header
, NULL
);
183 static void _isst_pbf_display_information(int cpu
, FILE *outf
, int level
,
184 struct isst_pbf_info
*pbf_info
,
190 snprintf(header
, sizeof(header
), "speed-select-base-freq-properties");
191 format_and_print(outf
, disp_level
, header
, NULL
);
193 snprintf(header
, sizeof(header
), "high-priority-base-frequency(MHz)");
194 snprintf(value
, sizeof(value
), "%d",
195 pbf_info
->p1_high
* DISP_FREQ_MULTIPLIER
);
196 format_and_print(outf
, disp_level
+ 1, header
, value
);
198 snprintf(header
, sizeof(header
), "high-priority-cpu-mask");
199 printcpumask(sizeof(value
), value
, pbf_info
->core_cpumask_size
,
200 pbf_info
->core_cpumask
);
201 format_and_print(outf
, disp_level
+ 1, header
, value
);
203 snprintf(header
, sizeof(header
), "high-priority-cpu-list");
204 printcpulist(sizeof(value
), value
,
205 pbf_info
->core_cpumask_size
,
206 pbf_info
->core_cpumask
);
207 format_and_print(outf
, disp_level
+ 1, header
, value
);
209 snprintf(header
, sizeof(header
), "low-priority-base-frequency(MHz)");
210 snprintf(value
, sizeof(value
), "%d",
211 pbf_info
->p1_low
* DISP_FREQ_MULTIPLIER
);
212 format_and_print(outf
, disp_level
+ 1, header
, value
);
214 if (is_clx_n_platform())
217 snprintf(header
, sizeof(header
), "tjunction-temperature(C)");
218 snprintf(value
, sizeof(value
), "%d", pbf_info
->t_prochot
);
219 format_and_print(outf
, disp_level
+ 1, header
, value
);
221 snprintf(header
, sizeof(header
), "thermal-design-power(W)");
222 snprintf(value
, sizeof(value
), "%d", pbf_info
->tdp
);
223 format_and_print(outf
, disp_level
+ 1, header
, value
);
226 static void _isst_fact_display_information(int cpu
, FILE *outf
, int level
,
227 int fact_bucket
, int fact_avx
,
228 struct isst_fact_info
*fact_info
,
231 struct isst_fact_bucket_info
*bucket_info
= fact_info
->bucket_info
;
236 for (j
= 0; j
< ISST_FACT_MAX_BUCKETS
; ++j
) {
237 if (fact_bucket
!= 0xff && fact_bucket
!= j
)
240 if (!bucket_info
[j
].high_priority_cores_count
)
246 fprintf(stderr
, "Invalid bucket\n");
250 snprintf(header
, sizeof(header
), "speed-select-turbo-freq-properties");
251 format_and_print(outf
, base_level
, header
, NULL
);
252 for (j
= 0; j
< ISST_FACT_MAX_BUCKETS
; ++j
) {
253 if (fact_bucket
!= 0xff && fact_bucket
!= j
)
256 if (!bucket_info
[j
].high_priority_cores_count
)
259 snprintf(header
, sizeof(header
), "bucket-%d", j
);
260 format_and_print(outf
, base_level
+ 1, header
, NULL
);
262 snprintf(header
, sizeof(header
), "high-priority-cores-count");
263 snprintf(value
, sizeof(value
), "%d",
264 bucket_info
[j
].high_priority_cores_count
);
265 format_and_print(outf
, base_level
+ 2, header
, value
);
267 if (fact_avx
& 0x01) {
268 snprintf(header
, sizeof(header
),
269 "high-priority-max-frequency(MHz)");
270 snprintf(value
, sizeof(value
), "%d",
271 bucket_info
[j
].sse_trl
* DISP_FREQ_MULTIPLIER
);
272 format_and_print(outf
, base_level
+ 2, header
, value
);
275 if (fact_avx
& 0x02) {
276 snprintf(header
, sizeof(header
),
277 "high-priority-max-avx2-frequency(MHz)");
278 snprintf(value
, sizeof(value
), "%d",
279 bucket_info
[j
].avx_trl
* DISP_FREQ_MULTIPLIER
);
280 format_and_print(outf
, base_level
+ 2, header
, value
);
283 if (fact_avx
& 0x04) {
284 snprintf(header
, sizeof(header
),
285 "high-priority-max-avx512-frequency(MHz)");
286 snprintf(value
, sizeof(value
), "%d",
287 bucket_info
[j
].avx512_trl
*
288 DISP_FREQ_MULTIPLIER
);
289 format_and_print(outf
, base_level
+ 2, header
, value
);
292 snprintf(header
, sizeof(header
),
293 "speed-select-turbo-freq-clip-frequencies");
294 format_and_print(outf
, base_level
+ 1, header
, NULL
);
295 snprintf(header
, sizeof(header
), "low-priority-max-frequency(MHz)");
296 snprintf(value
, sizeof(value
), "%d",
297 fact_info
->lp_clipping_ratio_license_sse
*
298 DISP_FREQ_MULTIPLIER
);
299 format_and_print(outf
, base_level
+ 2, header
, value
);
300 snprintf(header
, sizeof(header
),
301 "low-priority-max-avx2-frequency(MHz)");
302 snprintf(value
, sizeof(value
), "%d",
303 fact_info
->lp_clipping_ratio_license_avx2
*
304 DISP_FREQ_MULTIPLIER
);
305 format_and_print(outf
, base_level
+ 2, header
, value
);
306 snprintf(header
, sizeof(header
),
307 "low-priority-max-avx512-frequency(MHz)");
308 snprintf(value
, sizeof(value
), "%d",
309 fact_info
->lp_clipping_ratio_license_avx512
*
310 DISP_FREQ_MULTIPLIER
);
311 format_and_print(outf
, base_level
+ 2, header
, value
);
314 void isst_ctdp_display_core_info(int cpu
, FILE *outf
, char *prefix
,
315 unsigned int val
, char *str0
, char *str1
)
321 if (out_format_is_json()) {
322 snprintf(header
, sizeof(header
), "package-%d:die-%d:cpu-%d",
323 get_physical_package_id(cpu
), get_physical_die_id(cpu
),
325 format_and_print(outf
, level
++, header
, NULL
);
327 snprintf(header
, sizeof(header
), "package-%d",
328 get_physical_package_id(cpu
));
329 format_and_print(outf
, level
++, header
, NULL
);
330 snprintf(header
, sizeof(header
), "die-%d",
331 get_physical_die_id(cpu
));
332 format_and_print(outf
, level
++, header
, NULL
);
333 snprintf(header
, sizeof(header
), "cpu-%d", cpu
);
334 format_and_print(outf
, level
++, header
, NULL
);
338 snprintf(value
, sizeof(value
), "%s", str0
);
339 else if (str1
&& val
)
340 snprintf(value
, sizeof(value
), "%s", str1
);
342 snprintf(value
, sizeof(value
), "%u", val
);
343 format_and_print(outf
, level
, prefix
, value
);
345 format_and_print(outf
, 1, NULL
, NULL
);
348 void isst_ctdp_display_information(int cpu
, FILE *outf
, int tdp_level
,
349 struct isst_pkg_ctdp
*pkg_dev
)
356 if (pkg_dev
->processed
)
357 level
= print_package_info(cpu
, outf
);
359 for (i
= 0; i
<= pkg_dev
->levels
; ++i
) {
360 struct isst_pkg_ctdp_level_info
*ctdp_level
;
363 ctdp_level
= &pkg_dev
->ctdp_level
[i
];
364 if (!ctdp_level
->processed
)
367 snprintf(header
, sizeof(header
), "perf-profile-level-%d",
369 format_and_print(outf
, level
+ 1, header
, NULL
);
371 snprintf(header
, sizeof(header
), "cpu-count");
372 j
= get_cpu_count(get_physical_die_id(cpu
),
373 get_physical_die_id(cpu
));
374 snprintf(value
, sizeof(value
), "%d", j
);
375 format_and_print(outf
, level
+ 2, header
, value
);
377 j
= CPU_COUNT_S(ctdp_level
->core_cpumask_size
,
378 ctdp_level
->core_cpumask
);
380 snprintf(header
, sizeof(header
), "enable-cpu-count");
381 snprintf(value
, sizeof(value
), "%d", j
);
382 format_and_print(outf
, level
+ 2, header
, value
);
385 if (ctdp_level
->core_cpumask_size
) {
386 snprintf(header
, sizeof(header
), "enable-cpu-mask");
387 printcpumask(sizeof(value
), value
,
388 ctdp_level
->core_cpumask_size
,
389 ctdp_level
->core_cpumask
);
390 format_and_print(outf
, level
+ 2, header
, value
);
392 snprintf(header
, sizeof(header
), "enable-cpu-list");
393 printcpulist(sizeof(value
), value
,
394 ctdp_level
->core_cpumask_size
,
395 ctdp_level
->core_cpumask
);
396 format_and_print(outf
, level
+ 2, header
, value
);
399 snprintf(header
, sizeof(header
), "thermal-design-power-ratio");
400 snprintf(value
, sizeof(value
), "%d", ctdp_level
->tdp_ratio
);
401 format_and_print(outf
, level
+ 2, header
, value
);
403 snprintf(header
, sizeof(header
), "base-frequency(MHz)");
404 if (!ctdp_level
->sse_p1
)
405 ctdp_level
->sse_p1
= ctdp_level
->tdp_ratio
;
406 snprintf(value
, sizeof(value
), "%d",
407 ctdp_level
->sse_p1
* DISP_FREQ_MULTIPLIER
);
408 format_and_print(outf
, level
+ 2, header
, value
);
410 if (ctdp_level
->avx2_p1
) {
411 snprintf(header
, sizeof(header
), "base-frequency-avx2(MHz)");
412 snprintf(value
, sizeof(value
), "%d",
413 ctdp_level
->avx2_p1
* DISP_FREQ_MULTIPLIER
);
414 format_and_print(outf
, level
+ 2, header
, value
);
417 if (ctdp_level
->avx512_p1
) {
418 snprintf(header
, sizeof(header
), "base-frequency-avx512(MHz)");
419 snprintf(value
, sizeof(value
), "%d",
420 ctdp_level
->avx512_p1
* DISP_FREQ_MULTIPLIER
);
421 format_and_print(outf
, level
+ 2, header
, value
);
424 if (ctdp_level
->uncore_p1
) {
425 snprintf(header
, sizeof(header
), "uncore-frequency-min(MHz)");
426 snprintf(value
, sizeof(value
), "%d",
427 ctdp_level
->uncore_p1
* DISP_FREQ_MULTIPLIER
);
428 format_and_print(outf
, level
+ 2, header
, value
);
431 if (ctdp_level
->uncore_p0
) {
432 snprintf(header
, sizeof(header
), "uncore-frequency-max(MHz)");
433 snprintf(value
, sizeof(value
), "%d",
434 ctdp_level
->uncore_p0
* DISP_FREQ_MULTIPLIER
);
435 format_and_print(outf
, level
+ 2, header
, value
);
438 if (ctdp_level
->mem_freq
) {
439 snprintf(header
, sizeof(header
), "mem-frequency(MHz)");
440 snprintf(value
, sizeof(value
), "%d",
441 ctdp_level
->mem_freq
* DISP_FREQ_MULTIPLIER
);
442 format_and_print(outf
, level
+ 2, header
, value
);
445 snprintf(header
, sizeof(header
),
446 "speed-select-turbo-freq");
447 if (ctdp_level
->fact_support
) {
448 if (ctdp_level
->fact_enabled
)
449 snprintf(value
, sizeof(value
), "enabled");
451 snprintf(value
, sizeof(value
), "disabled");
453 snprintf(value
, sizeof(value
), "unsupported");
454 format_and_print(outf
, level
+ 2, header
, value
);
456 snprintf(header
, sizeof(header
),
457 "speed-select-base-freq");
458 if (ctdp_level
->pbf_support
) {
459 if (ctdp_level
->pbf_enabled
)
460 snprintf(value
, sizeof(value
), "enabled");
462 snprintf(value
, sizeof(value
), "disabled");
464 snprintf(value
, sizeof(value
), "unsupported");
465 format_and_print(outf
, level
+ 2, header
, value
);
467 snprintf(header
, sizeof(header
),
468 "speed-select-core-power");
469 if (ctdp_level
->sst_cp_support
) {
470 if (ctdp_level
->sst_cp_enabled
)
471 snprintf(value
, sizeof(value
), "enabled");
473 snprintf(value
, sizeof(value
), "disabled");
475 snprintf(value
, sizeof(value
), "unsupported");
476 format_and_print(outf
, level
+ 2, header
, value
);
478 if (is_clx_n_platform()) {
479 if (ctdp_level
->pbf_support
)
480 _isst_pbf_display_information(cpu
, outf
,
482 &ctdp_level
->pbf_info
,
487 if (ctdp_level
->pkg_tdp
) {
488 snprintf(header
, sizeof(header
), "thermal-design-power(W)");
489 snprintf(value
, sizeof(value
), "%d", ctdp_level
->pkg_tdp
);
490 format_and_print(outf
, level
+ 2, header
, value
);
493 if (ctdp_level
->t_proc_hot
) {
494 snprintf(header
, sizeof(header
), "tjunction-max(C)");
495 snprintf(value
, sizeof(value
), "%d", ctdp_level
->t_proc_hot
);
496 format_and_print(outf
, level
+ 2, header
, value
);
499 snprintf(header
, sizeof(header
), "turbo-ratio-limits-sse");
500 format_and_print(outf
, level
+ 2, header
, NULL
);
501 for (j
= 0; j
< 8; ++j
) {
502 snprintf(header
, sizeof(header
), "bucket-%d", j
);
503 format_and_print(outf
, level
+ 3, header
, NULL
);
505 snprintf(header
, sizeof(header
), "core-count");
506 snprintf(value
, sizeof(value
), "%llu", (ctdp_level
->buckets_info
>> (j
* 8)) & 0xff);
507 format_and_print(outf
, level
+ 4, header
, value
);
509 snprintf(header
, sizeof(header
),
510 "max-turbo-frequency(MHz)");
511 snprintf(value
, sizeof(value
), "%d",
512 ctdp_level
->trl_sse_active_cores
[j
] *
513 DISP_FREQ_MULTIPLIER
);
514 format_and_print(outf
, level
+ 4, header
, value
);
517 if (ctdp_level
->trl_avx_active_cores
[0]) {
518 snprintf(header
, sizeof(header
), "turbo-ratio-limits-avx2");
519 format_and_print(outf
, level
+ 2, header
, NULL
);
520 for (j
= 0; j
< 8; ++j
) {
521 snprintf(header
, sizeof(header
), "bucket-%d", j
);
522 format_and_print(outf
, level
+ 3, header
, NULL
);
524 snprintf(header
, sizeof(header
), "core-count");
525 snprintf(value
, sizeof(value
), "%llu", (ctdp_level
->buckets_info
>> (j
* 8)) & 0xff);
526 format_and_print(outf
, level
+ 4, header
, value
);
528 snprintf(header
, sizeof(header
), "max-turbo-frequency(MHz)");
529 snprintf(value
, sizeof(value
), "%d", ctdp_level
->trl_avx_active_cores
[j
] * DISP_FREQ_MULTIPLIER
);
530 format_and_print(outf
, level
+ 4, header
, value
);
534 if (ctdp_level
->trl_avx_512_active_cores
[0]) {
535 snprintf(header
, sizeof(header
), "turbo-ratio-limits-avx512");
536 format_and_print(outf
, level
+ 2, header
, NULL
);
537 for (j
= 0; j
< 8; ++j
) {
538 snprintf(header
, sizeof(header
), "bucket-%d", j
);
539 format_and_print(outf
, level
+ 3, header
, NULL
);
541 snprintf(header
, sizeof(header
), "core-count");
542 snprintf(value
, sizeof(value
), "%llu", (ctdp_level
->buckets_info
>> (j
* 8)) & 0xff);
543 format_and_print(outf
, level
+ 4, header
, value
);
545 snprintf(header
, sizeof(header
), "max-turbo-frequency(MHz)");
546 snprintf(value
, sizeof(value
), "%d", ctdp_level
->trl_avx_512_active_cores
[j
] * DISP_FREQ_MULTIPLIER
);
547 format_and_print(outf
, level
+ 4, header
, value
);
551 if (ctdp_level
->pbf_support
)
552 _isst_pbf_display_information(cpu
, outf
, i
,
553 &ctdp_level
->pbf_info
,
555 if (ctdp_level
->fact_support
)
556 _isst_fact_display_information(cpu
, outf
, i
, 0xff, 0xff,
557 &ctdp_level
->fact_info
,
561 format_and_print(outf
, 1, NULL
, NULL
);
565 void isst_ctdp_display_information_start(FILE *outf
)
568 format_and_print(outf
, 0, "start", NULL
);
572 void isst_ctdp_display_information_end(FILE *outf
)
574 format_and_print(outf
, 0, NULL
, NULL
);
578 void isst_pbf_display_information(int cpu
, FILE *outf
, int level
,
579 struct isst_pbf_info
*pbf_info
)
583 _level
= print_package_info(cpu
, outf
);
584 _isst_pbf_display_information(cpu
, outf
, level
, pbf_info
, _level
+ 1);
585 format_and_print(outf
, 1, NULL
, NULL
);
588 void isst_fact_display_information(int cpu
, FILE *outf
, int level
,
589 int fact_bucket
, int fact_avx
,
590 struct isst_fact_info
*fact_info
)
594 _level
= print_package_info(cpu
, outf
);
595 _isst_fact_display_information(cpu
, outf
, level
, fact_bucket
, fact_avx
,
596 fact_info
, _level
+ 1);
597 format_and_print(outf
, 1, NULL
, NULL
);
600 void isst_clos_display_information(int cpu
, FILE *outf
, int clos
,
601 struct isst_clos_config
*clos_config
)
607 level
= print_package_info(cpu
, outf
);
609 snprintf(header
, sizeof(header
), "core-power");
610 format_and_print(outf
, level
+ 1, header
, NULL
);
612 snprintf(header
, sizeof(header
), "clos");
613 snprintf(value
, sizeof(value
), "%d", clos
);
614 format_and_print(outf
, level
+ 2, header
, value
);
616 snprintf(header
, sizeof(header
), "epp");
617 snprintf(value
, sizeof(value
), "%d", clos_config
->epp
);
618 format_and_print(outf
, level
+ 2, header
, value
);
620 snprintf(header
, sizeof(header
), "clos-proportional-priority");
621 snprintf(value
, sizeof(value
), "%d", clos_config
->clos_prop_prio
);
622 format_and_print(outf
, level
+ 2, header
, value
);
624 snprintf(header
, sizeof(header
), "clos-min");
625 snprintf(value
, sizeof(value
), "%d MHz", clos_config
->clos_min
* DISP_FREQ_MULTIPLIER
);
626 format_and_print(outf
, level
+ 2, header
, value
);
628 snprintf(header
, sizeof(header
), "clos-max");
629 if (clos_config
->clos_max
== 0xff)
630 snprintf(value
, sizeof(value
), "Max Turbo frequency");
632 snprintf(value
, sizeof(value
), "%d MHz", clos_config
->clos_max
* DISP_FREQ_MULTIPLIER
);
633 format_and_print(outf
, level
+ 2, header
, value
);
635 snprintf(header
, sizeof(header
), "clos-desired");
636 snprintf(value
, sizeof(value
), "%d MHz", clos_config
->clos_desired
* DISP_FREQ_MULTIPLIER
);
637 format_and_print(outf
, level
+ 2, header
, value
);
639 format_and_print(outf
, level
, NULL
, NULL
);
642 void isst_clos_display_clos_information(int cpu
, FILE *outf
,
643 int clos_enable
, int type
,
650 level
= print_package_info(cpu
, outf
);
652 snprintf(header
, sizeof(header
), "core-power");
653 format_and_print(outf
, level
+ 1, header
, NULL
);
655 snprintf(header
, sizeof(header
), "support-status");
657 snprintf(value
, sizeof(value
), "supported");
659 snprintf(value
, sizeof(value
), "unsupported");
660 format_and_print(outf
, level
+ 2, header
, value
);
662 snprintf(header
, sizeof(header
), "enable-status");
664 snprintf(value
, sizeof(value
), "enabled");
666 snprintf(value
, sizeof(value
), "disabled");
667 format_and_print(outf
, level
+ 2, header
, value
);
669 snprintf(header
, sizeof(header
), "clos-enable-status");
671 snprintf(value
, sizeof(value
), "enabled");
673 snprintf(value
, sizeof(value
), "disabled");
674 format_and_print(outf
, level
+ 2, header
, value
);
676 snprintf(header
, sizeof(header
), "priority-type");
678 snprintf(value
, sizeof(value
), "ordered");
680 snprintf(value
, sizeof(value
), "proportional");
681 format_and_print(outf
, level
+ 2, header
, value
);
683 format_and_print(outf
, level
, NULL
, NULL
);
686 void isst_clos_display_assoc_information(int cpu
, FILE *outf
, int clos
)
692 level
= print_package_info(cpu
, outf
);
694 snprintf(header
, sizeof(header
), "get-assoc");
695 format_and_print(outf
, level
+ 1, header
, NULL
);
697 snprintf(header
, sizeof(header
), "clos");
698 snprintf(value
, sizeof(value
), "%d", clos
);
699 format_and_print(outf
, level
+ 2, header
, value
);
701 format_and_print(outf
, level
, NULL
, NULL
);
704 void isst_display_result(int cpu
, FILE *outf
, char *feature
, char *cmd
,
712 level
= print_package_info(cpu
, outf
);
714 snprintf(header
, sizeof(header
), "%s", feature
);
715 format_and_print(outf
, level
+ 1, header
, NULL
);
716 snprintf(header
, sizeof(header
), "%s", cmd
);
718 snprintf(value
, sizeof(value
), "success");
720 snprintf(value
, sizeof(value
), "failed(error %d)", result
);
721 format_and_print(outf
, level
+ 2, header
, value
);
723 format_and_print(outf
, level
, NULL
, NULL
);
726 void isst_display_error_info_message(int error
, char *msg
, int arg_valid
, int arg
)
728 FILE *outf
= get_output_file();
729 static int error_index
;
733 if (!out_format_is_json()) {
735 snprintf(value
, sizeof(value
), "%s %d", msg
, arg
);
737 snprintf(value
, sizeof(value
), "%s", msg
);
740 fprintf(outf
, "Error: %s\n", value
);
742 fprintf(outf
, "Information: %s\n", value
);
747 format_and_print(outf
, 0, "start", NULL
);
750 snprintf(header
, sizeof(header
), "Error%d", error_index
++);
752 snprintf(header
, sizeof(header
), "Information:%d", error_index
++);
753 format_and_print(outf
, 1, header
, NULL
);
755 snprintf(header
, sizeof(header
), "message");
757 snprintf(value
, sizeof(value
), "%s %d", msg
, arg
);
759 snprintf(value
, sizeof(value
), "%s", msg
);
761 format_and_print(outf
, 2, header
, value
);
762 format_and_print(outf
, 1, NULL
, NULL
);
764 format_and_print(outf
, 0, NULL
, NULL
);