[lib] Enhance Logger: gpu_metrics + enable console out

* Updates:
    - Env variable RSMI_LOGGING=0 or any other value
        -> all logging off
    - Env variable RSMI_LOGGING=1 -> logs only
    - Env variable RSMI_LOGGING=2 -> console only
    - Env variable RSMI_LOGGING=3 -> both logs + console
    - Metrics output includes hexdump of current file
      and decoded metrics (functions: logHexDump
      and log_gpu_metrics)
    - System info gathered, now includes if system's
      perceived endianness - little or big endian
      helpful for viewing decoded hexdump or any
      binary translation
    - Added templates for printing unsigned hex
      (print_unsigned_hex_and_int), unsigned integers
      (print_unsigned_int), and printing both unsigned
      hex and int with an optional header
      (print_unsigned_hex_and_int)
    - Fixed some build compile warnings/errors -
      ex. doing strncpys for sku or board names
      this operation is expected and needed
      and for temp file writes if unsuccessful
      we now properly send RSMI_STATUS_FILE_ERROR
    - Fixed on RHEL 8.8/9.x logrotate does not properly
      initialize

Change-Id: Ifa0f0218c9cafd0a8cd6aa8e7f94d61e9107200f
Signed-off-by: Charis Poag <Charis.Poag@amd.com>
This commit is contained in:
Charis Poag
2023-08-01 21:46:19 -05:00
förälder 0522439ac2
incheckning 9c7eed7edc
12 ändrade filer med 470 tillägg och 24 borttagningar
+3
Visa fil
@@ -166,8 +166,11 @@ TRY
rsmi_dev_name_get(dev_inx, dev->device_name, DEVICE_NAME_LEN);
rsmi_dev_vbios_version_get(dev_inx, buf, buf_size);
if (std::strlen(buf) > 0) {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
std::strncpy(dev->sku_name, &buf[4], 6);
std::strncpy(dev->board_name, buf, 12);
#pragma GCC diagnostic pop
}
rsmi_dev_serial_number_get(dev_inx, dev->board_serial_number,
BOARD_SERIAL_NUM_LEN);