| | 404 | static void print_chip_power(const sensors_chip_name *name, |
|---|
| | 405 | const sensors_feature *feature, |
|---|
| | 406 | int label_size) |
|---|
| | 407 | { |
|---|
| | 408 | int need_space = 0; |
|---|
| | 409 | const sensors_subfeature *sf, *sfmin, *sfmax, *sfint; |
|---|
| | 410 | char *label; |
|---|
| | 411 | |
|---|
| | 412 | if (!(label = sensors_get_label(name, feature))) { |
|---|
| | 413 | fprintf(stderr, "ERROR: Can't get label of feature %s!\n", |
|---|
| | 414 | feature->name); |
|---|
| | 415 | return; |
|---|
| | 416 | } |
|---|
| | 417 | print_label(label, label_size); |
|---|
| | 418 | free(label); |
|---|
| | 419 | |
|---|
| | 420 | sf = sensors_get_subfeature(name, feature, |
|---|
| | 421 | SENSORS_SUBFEATURE_POWER_AVERAGE); |
|---|
| | 422 | if (sf) |
|---|
| | 423 | printf("%6.2f W", get_value(name, sf)); |
|---|
| | 424 | else |
|---|
| | 425 | printf(" N/A"); |
|---|
| | 426 | |
|---|
| | 427 | sfmin = sensors_get_subfeature(name, feature, |
|---|
| | 428 | SENSORS_SUBFEATURE_POWER_AVERAGE_HIGHEST); |
|---|
| | 429 | sfmax = sensors_get_subfeature(name, feature, |
|---|
| | 430 | SENSORS_SUBFEATURE_POWER_AVERAGE_LOWEST); |
|---|
| | 431 | sfint = sensors_get_subfeature(name, feature, |
|---|
| | 432 | SENSORS_SUBFEATURE_POWER_AVERAGE_INTERVAL); |
|---|
| | 433 | if (sfmin || sfmax || sfint) { |
|---|
| | 434 | printf(" ("); |
|---|
| | 435 | |
|---|
| | 436 | if (sfmin) { |
|---|
| | 437 | printf("min = %6.2f W", get_value(name, sfmin)); |
|---|
| | 438 | need_space = 1; |
|---|
| | 439 | } |
|---|
| | 440 | |
|---|
| | 441 | if (sfmax) { |
|---|
| | 442 | printf("%smax = %6.2f W", (need_space ? ", " : ""), |
|---|
| | 443 | get_value(name, sfmax)); |
|---|
| | 444 | need_space = 1; |
|---|
| | 445 | } |
|---|
| | 446 | |
|---|
| | 447 | if (sfint) { |
|---|
| | 448 | printf("%sinterval = %6.2f s", (need_space ? ", " : ""), |
|---|
| | 449 | get_value(name, sfint)); |
|---|
| | 450 | need_space = 1; |
|---|
| | 451 | } |
|---|
| | 452 | printf(")"); |
|---|
| | 453 | } |
|---|
| | 454 | |
|---|
| | 455 | printf("\n"); |
|---|
| | 456 | } |
|---|
| | 457 | |
|---|
| | 458 | static void print_chip_energy(const sensors_chip_name *name, |
|---|
| | 459 | const sensors_feature *feature, |
|---|
| | 460 | int label_size) |
|---|
| | 461 | { |
|---|
| | 462 | const sensors_subfeature *sf; |
|---|
| | 463 | char *label; |
|---|
| | 464 | |
|---|
| | 465 | if (!(label = sensors_get_label(name, feature))) { |
|---|
| | 466 | fprintf(stderr, "ERROR: Can't get label of feature %s!\n", |
|---|
| | 467 | feature->name); |
|---|
| | 468 | return; |
|---|
| | 469 | } |
|---|
| | 470 | print_label(label, label_size); |
|---|
| | 471 | free(label); |
|---|
| | 472 | |
|---|
| | 473 | sf = sensors_get_subfeature(name, feature, |
|---|
| | 474 | SENSORS_SUBFEATURE_ENERGY_INPUT); |
|---|
| | 475 | if (sf) |
|---|
| | 476 | printf("%6.2f J", get_value(name, sf)); |
|---|
| | 477 | else |
|---|
| | 478 | printf(" N/A"); |
|---|
| | 479 | |
|---|
| | 480 | printf("\n"); |
|---|
| | 481 | } |
|---|
| | 482 | |
|---|