29#if __linux__ || __APPLE__
48#define MAX_DEVICE_NAME_SIZE (9)
49#define ABSOLUTE_TEMP_ZERO (-273)
54#define VIDEO_PROCESSING_SLICES 4
55#define THROTTLE_REF_WIN_US (1 << (10 + 7))
56#define VIDEO_SLICE_TIME (THROTTLE_REF_WIN_US * VIDEO_PROCESSING_SLICES)
68#include <cutils/properties.h>
69#define PROP_DECODER_TYPE "nidec_service_init"
70#define LOG_TAG "ni_rsrc_mon"
87static BOOL WINAPI console_ctrl_handler(DWORD ctrl_type)
121void sig_handler(
int sig)
123 if (sig == SIGTERM || sig == SIGINT || sig == SIGHUP)
136void setup_signal_handler(
void)
138 if (signal(SIGTERM, sig_handler) == SIG_ERR ||
139 signal(SIGHUP, sig_handler) == SIG_ERR ||
140 signal(SIGINT, sig_handler) == SIG_ERR)
142 perror(
"ERROR: signal handler setup");
153void get_pcie_addr(
char *device_name,
char *pcie)
165int get_numa_node(
char *device_name)
184 ni_device_handle_t device_handle)
188 fprintf(stderr,
"Error: device_type %d is not a valid device type\n",
193 if (
device_handles[xcoder_device_type][module_id] == device_handle)
196 NI_INVALID_DEVICE_HANDLE;
201 "Error: device_handle to remove %" PRId64
202 "not match device_handles[%d][%d]=%" PRId64
"\n",
203 (int64_t)device_handle, device_type, module_id,
225 const size_t len = strlen(numArray);
227 for (i = 0; i < len; i++)
229 if (!isdigit(numArray[i]))
231 fprintf(stderr,
"invalid, ABORTING\n");
236 return len == i ?
atoi(numArray) : 0;
249 if ( *(int32_t*)a < *(int32_t*)b )
return -1;
250 if ( *(int32_t*)a > *(int32_t*)b )
return 1;
261 else if ((index >= 0 && index < 4) || (index >= 10 && index < 13))
265 else if (index >= 4 && index < 10)
269 else if (index >= 13 && index < 15)
278static char sid[5] =
"0000";
284 snprintf(sid,
sizeof(sid),
"%04x", 0);
289 snprintf(sid,
sizeof(sid),
"%04x",
id);
297 int32_t **module_ids)
299 unsigned int device_count;
302 size_of_i32 =
sizeof(int32_t);
304 device_count = p_device_queue->
xcoder_cnt[device_type];
305 *module_ids = malloc(size_of_i32 * device_count);
308 fprintf(stderr,
"ERROR: malloc() failed for module_ids\n");
313 p_device_queue->
xcoders[device_type],
314 size_of_i32 * device_count);
322 g_device_type_str[device_type],
335 if (!p_device_context)
343 if (
device_handles[xcoder_device_type][module_id] != NI_INVALID_DEVICE_HANDLE)
352 if (p_session_context->
device_handle != NI_INVALID_DEVICE_HANDLE)
359 if (p_session_context->
device_handle == NI_INVALID_DEVICE_HANDLE)
364 "ERROR: ni_device_open2() failed for %s: %s\n",
373 p_session_context->
hw_id =
382 "ERROR: cannot print detailed info for %s as it has FW API "
405 "ERROR: ni_device_session_query() returned %d for %s:%s:%d\n",
422 memcpy(p_session_context->
fw_rev,
435 if (!p_device_context)
441 if (p_session_context->
device_handle == NI_INVALID_DEVICE_HANDLE)
446 "ERROR: ni_device_open2() failed for %s: %s\n",
454 p_session_context->
hw_id =
458 return return_code ? false :
true;
464 unsigned int module_count;
465 int32_t *module_id_arr = NULL;
470 module_count =
get_modules(module_type, coders, module_name, &module_id_arr);
472 printf(
"Error: module not found!\n");
476 bool gen_log_file =
true;
478 void* p_log_buffer = NULL;
479 if (devid >= 0 && (uint32_t)devid < module_count)
485 if (!
open_and_get_log(p_device_context, sessionCtxt, &p_log_buffer, gen_log_file)) {
486 printf(
"Error: failed to dump fw log of card:%d blk_name:%s\n",
489 printf(
"Success: dumped fw log of card:%d blk_name:%s\n",
499 for (i = 0; i < module_count; i++)
502 if (!
open_and_get_log(p_device_context, sessionCtxt, &p_log_buffer, gen_log_file)) {
503 printf(
"Error: failed to dump fw log of card:%d blk_name:%s\n",
507 printf(
"Success: dumped fw log of card:%d blk_name:%s\n",
522 switch (*p_device_type)
535#define DYN_STR_BUF_CHUNK_SIZE 4096
557 int add_buf_size = 0;
558 char *tmp_char_ptr = NULL;
562 fprintf(stderr,
"ERROR: invalid param *dyn_str_buf\n");
576 formatted_len = vsnprintf(NULL, 0, fmt, tmp_vl);
581 add_buf_size = (formatted_len + 1) > avail_buf ?
595 fprintf(stderr,
"ERROR: strcat_dyn_buf() failed realloc()\n");
622 unsigned int index, device_count;
645 strcat_dyn_buf(&output_buf,
"Num %ss: %u\n", device_name, device_count);
651 "INDEX LOAD(VPU MODEL FW ) INST MEM(TOTAL CRITICAL SHARE ) "
652 "DEVICE L_FL2V N_FL2V FR N_FR\n");
657 "INDEX LOAD(VPU FW ) INST MEM(TOTAL SHARE ) "
658 "DEVICE L_FL2V N_FL2V FR N_FR\n");
662 "INDEX LOAD(VPU MODEL FW ) INST MEM(TOTAL CRITICAL SHARE P2P) "
663 "DEVICE L_FL2V N_FL2V FR N_FR\n");
667 "INDEX LOAD( FW ) INST MEM(TOTAL SHARE P2P) "
668 "DEVICE L_FL2V N_FL2V FR N_FR\n");
674 for (index = 0; index < device_count; index++)
682 device_name, detail, detail_data_v1))
691 "%-5d %-3u %-3s %-3u %-3u/%-3d %-3u %-3u "
692 "%-3u %-11s %-8.8s %-8.8s %-8.8s %-8.8s\n",
711 "%-5d %-3u %-3u %-3u/%-3d %-3u "
712 "%-3u %-11s %-8.8s %-8.8s %-8.8s %-8.8s\n",
728 "%-5d %-3u %-3s %-3u %-3u/%-3d %-3u %-3u "
729 "%-3u %-3u %-11s %-8.8s %-8.8s %-8.8s %-8.8s\n",
748 "%-5d %-3u %-3u/%-3d %-3u "
749 "%-3u %-3u %-11s %-8.8s %-8.8s %-8.8s %-8.8s\n",
796 g_temp_load = (uint32_t*)calloc(device_count,
sizeof(uint32_t));
799 fprintf(stderr,
"ERROR: calloc() failed for g_temp_load\n");
802 g_temp_pload = (uint32_t*)calloc(device_count,
sizeof(uint32_t));
805 fprintf(stderr,
"ERROR: calloc() failed for g_temp_pload\n");
811 fprintf(stderr,
"ERROR: calloc() failed for g_temp_pthroughput\n");
817 fprintf(stderr,
"ERROR: calloc() failed for g_temp_sharemem\n");
830 "INDEX LOAD( FW ) PCIE_Card2Host_Gbps "
831 "DEVICE L_FL2V N_FL2V FR N_FR\n");
836 "INDEX LOAD( FW ) MEM( SHARE ) "
837 "DEVICE L_FL2V N_FL2V FR N_FR\n");
842 printf(
"%s", output_buf.
str_buf);
851 for (index = 0; index < device_count; index++)
860 device_name, detail, detail_data_v1))
869 "ERROR: ni_query_nvme_status() returned %d for %s:%s:%d\n",
892 "%-11s %-8.8s %-8.8s %-8.8s %-8.8s\n",
909 "%-11s %-8.8s %-8.8s %-8.8s %-8.8s\n",
933 printf(
"%s", output_buf.
str_buf);
940 bool copied_block_name;
944 unsigned int number_of_quadras;
945 unsigned int number_of_device_types_present;
946 unsigned int device_type_counter;
947 unsigned int *maximum_firmware_loads;
948 unsigned int *maximum_firmware_loads_per_quadra;
962 maximum_firmware_loads = calloc(number_of_quadras,
sizeof(
unsigned int));
963 if (!maximum_firmware_loads)
965 fprintf(stderr,
"calloc() returned NULL\n");
969 maximum_firmware_loads_per_quadra = NULL;
970 p_device_context = NULL;
972 for (guid = 0; guid < number_of_quadras; guid++)
975 maximum_firmware_loads_per_quadra = maximum_firmware_loads + guid;
976 number_of_device_types_present = 0;
977 device_type_counter = 0;
978 copied_block_name =
false;
981 device_type < maximum_device_type;
984 if (p_device_queue->
xcoders[device_type][guid] != -1)
986 number_of_device_types_present++;
991 device_type < maximum_device_type;
995 g_device_type_str[device_type],
998 if (p_device_queue->
xcoders[device_type][guid] == -1)
1005 p_device_queue->
xcoders[device_type][guid]);
1009 device_name, detail, detail_data_v1))
1020 "%s: Simple output not supported. Try '-o full' "
1030 if (!copied_block_name)
1035 copied_block_name =
true;
1038 if (*maximum_firmware_loads_per_quadra < p_session_context->load_query.
fw_load)
1043 device_type_counter++;
1044 if (device_type_counter < number_of_device_types_present)
1065 if (*maximum_firmware_loads_per_quadra < load_query.
fw_load)
1067 *maximum_firmware_loads_per_quadra = load_query.
fw_load;
1069 if (*maximum_firmware_loads_per_quadra < load_query.
tp_fw_load)
1071 *maximum_firmware_loads_per_quadra = load_query.
tp_fw_load;
1074 *maximum_firmware_loads_per_quadra);
1079 stderr,
"ERROR: ni_query_nvme_status() returned %d for %s:%s:%d\n",
1093 printf(
"%s", output_buf.
str_buf);
1095 free(maximum_firmware_loads);
1101 unsigned int i, index, device_count;
1103 int32_t *module_ids;
1111 int first_item_printed = 0;
1112 int first_device_type_printed = 0;
1117 device_type != max_device_type;
1130 if(first_device_type_printed)
1139 first_item_printed = 0;
1141 for (i = 0; i < device_count; i++)
1149 device_name, detail, detail_data_v1))
1158 if(first_item_printed)
1167 "\t\t\t\"NUMBER\": %u,\n"
1168 "\t\t\t\"INDEX\": %u,\n"
1169 "\t\t\t\"AvgCost\": %u,\n"
1170 "\t\t\t\"FrameRate\": %u,\n"
1171 "\t\t\t\"IDR\": %u,\n"
1172 "\t\t\t\"InFrame\": %u,\n"
1173 "\t\t\t\"OutFrame\": %u,\n"
1174 "\t\t\t\"Width\": %u,\n"
1175 "\t\t\t\"Height\": %u,\n"
1176 "\t\t\t\"SID\": \"%s\",\n"
1177 "\t\t\t\"DEVICE\": \"%s\"\n"
1195 "\t\t\t\"NUMBER\": %u,\n"
1196 "\t\t\t\"INDEX\": %u,\n"
1197 "\t\t\t\"AvgCost\": %u,\n"
1198 "\t\t\t\"FrameRate\": %u,\n"
1199 "\t\t\t\"IDR\": %u,\n"
1200 "\t\t\t\"UserIDR\": %u,\n"
1201 "\t\t\t\"InFrame\": %u,\n"
1202 "\t\t\t\"OutFrame\": %u,\n"
1203 "\t\t\t\"BR\": %u,\n"
1204 "\t\t\t\"AvgBR\": %u,\n"
1205 "\t\t\t\"Width\": %u,\n"
1206 "\t\t\t\"Height\": %u,\n"
1207 "\t\t\t\"Format\": \"%s\",\n"
1208 "\t\t\t\"SID\": \"%s\",\n"
1209 "\t\t\t\"DEVICE\": \"%s\"\n"
1227 first_item_printed = 1;
1236 first_device_type_printed = 1;
1244 printf(
"%s", output_buf.
str_buf);
1255 unsigned int i, index, device_count;
1257 int32_t *module_ids;
1258 uint32_t total_contexts;
1260 uint32_t model_load;
1262 char pcie[64] = {0};
1276 device_type != max_device_type;
1290 for (i = 0; i < device_count; i++)
1298 device_name, detail, detail_data_v1))
1335 "\t\t\t\"NUMBER\": %u,\n"
1336 "\t\t\t\"INDEX\": %u,\n"
1337 "\t\t\t\"AvgCost\": %u,\n"
1338 "\t\t\t\"FrameRate\": %u,\n"
1339 "\t\t\t\"IDR\": %u,\n"
1340 "\t\t\t\"InFrame\": %u,\n"
1341 "\t\t\t\"OutFrame\": %u,\n"
1342 "\t\t\t\"Width\": %u,\n"
1343 "\t\t\t\"Height\": %u,\n"
1344 "\t\t\t\"SID\": %s,\n"
1345 "\t\t\t\"DEVICE\": \"%s\",\n"
1363 "\t\t\t\"NUMBER\": %u,\n"
1364 "\t\t\t\"INDEX\": %u,\n"
1365 "\t\t\t\"AvgCost\": %u,\n"
1366 "\t\t\t\"FrameRate\": %u,\n"
1367 "\t\t\t\"IDR\": %u,\n"
1368 "\t\t\t\"UserIDR\": %u,\n"
1369 "\t\t\t\"InFrame\": %u,\n"
1370 "\t\t\t\"OutFrame\": %u,\n"
1371 "\t\t\t\"BR\": %u,\n"
1372 "\t\t\t\"AvgBR\": %u,\n"
1373 "\t\t\t\"Width\": %u,\n"
1374 "\t\t\t\"Height\": %u,\n"
1375 "\t\t\t\"Format\": %s,\n"
1376 "\t\t\t\"SID\": %s,\n"
1377 "\t\t\t\"DEVICE\": \"%s\",\n"
1411 "\t\t\t\"NUMBER\": %u,\n"
1412 "\t\t\t\"INDEX\": %d,\n"
1413 "\t\t\t\"LOAD\": %u,\n"
1414 "\t\t\t\"LOAD-ALL\": %u,\n"
1415 "\t\t\t\"MODEL_LOAD\": %u,\n"
1416 "\t\t\t\"MODEL_LOAD-ALL\": %u,\n"
1417 "\t\t\t\"FW_LOAD\": %u,\n"
1418 "\t\t\t\"INST\": %u,\n"
1419 "\t\t\t\"INST-ALL\": %u,\n"
1420 "\t\t\t\"MAX_INST\": %d,\n"
1421 "\t\t\t\"MEM\": %u,\n"
1422 "\t\t\t\"CRITICAL_MEM\": %u,\n"
1423 "\t\t\t\"SHARE_MEM\": %u,\n"
1424 "\t\t\t\"P2P_MEM\": %u,\n"
1425 "\t\t\t\"DEVICE\": \"%s\",\n"
1426 "\t\t\t\"L_FL2V\": \"%s\",\n"
1427 "\t\t\t\"N_FL2V\": \"%s\",\n"
1428 "\t\t\t\"FR\": \"%.8s\",\n"
1429 "\t\t\t\"N_FR\": \"%.8s\""
1431 ",\n\t\t\t\"NUMA_NODE\": %d,\n"
1432 "\t\t\t\"PCIE_ADDR\": \"%s\"\n"
1439 device_name, device_count,
1469 "\t\t\t\"NUMBER\": %u,\n"
1470 "\t\t\t\"INDEX\": %d,\n"
1471 "\t\t\t\"LOAD\": %u,\n"
1472 "\t\t\t\"MODEL_LOAD\": %u,\n"
1473 "\t\t\t\"FW_LOAD\": %u,\n"
1474 "\t\t\t\"INST\": %u,\n"
1475 "\t\t\t\"MAX_INST\": %d,\n"
1476 "\t\t\t\"MEM\": %u,\n"
1477 "\t\t\t\"CRITICAL_MEM\": %u,\n"
1478 "\t\t\t\"SHARE_MEM\": %u,\n"
1479 "\t\t\t\"P2P_MEM\": %u,\n"
1480 "\t\t\t\"DEVICE\": \"%s\",\n"
1481 "\t\t\t\"L_FL2V\": \"%s\",\n"
1482 "\t\t\t\"N_FL2V\": \"%s\",\n"
1483 "\t\t\t\"FR\": \"%.8s\",\n"
1484 "\t\t\t\"N_FR\": \"%.8s\""
1486 ",\n\t\t\t\"NUMA_NODE\": %d,\n"
1487 "\t\t\t\"PCIE_ADDR\": \"%s\"\n"
1494 device_name, device_count,
1531 printf(
"%s", output_buf.
str_buf);
1554 printf(
"%s", output_buf.
str_buf);
1561 g_temp_load = (uint32_t*)calloc(device_count,
sizeof(uint32_t));
1564 fprintf(stderr,
"ERROR: calloc() failed for g_temp_load\n");
1567 g_temp_pload = (uint32_t*)calloc(device_count,
sizeof(uint32_t));
1570 fprintf(stderr,
"ERROR: calloc() failed for g_temp_pload\n");
1576 fprintf(stderr,
"ERROR: calloc() failed for g_temp_pthroughput\n");
1582 fprintf(stderr,
"ERROR: calloc() failed for g_temp_sharemem\n");
1591 for (i = 0; i < device_count; i++)
1599 device_name, detail, detail_data_v1))
1609 "ERROR: ni_query_nvme_status() returned %d for %s:%s:%d\n",
1637 "\t\t\t\"NUMBER\": %u,\n"
1638 "\t\t\t\"INDEX\": %d,\n"
1639 "\t\t\t\"LOAD\": 0,\n"
1640 "\t\t\t\"MODEL_LOAD\": 0,\n"
1641 "\t\t\t\"FW_LOAD\": %u,\n"
1642 "\t\t\t\"INST\": 0,\n"
1643 "\t\t\t\"MAX_INST\": 0,\n"
1644 "\t\t\t\"MEM\": 0,\n"
1645 "\t\t\t\"CRITICAL_MEM\": 0,\n"
1646 "\t\t\t\"SHARE_MEM\": %u,\n"
1647 "\t\t\t\"PCIE_THROUGHPUT\": %.1f,\n"
1648 "\t\t\t\"P2P_MEM\": 0,\n"
1649 "\t\t\t\"DEVICE\": \"%s\",\n"
1650 "\t\t\t\"L_FL2V\": \"%s\",\n"
1651 "\t\t\t\"N_FL2V\": \"%s\",\n"
1652 "\t\t\t\"FR\": \"%.8s\",\n"
1653 "\t\t\t\"N_FR\": \"%.8s\""
1655 ",\n\t\t\t\"NUMA_NODE\": %d,\n"
1656 "\t\t\t\"PCIE_ADDR\": \"%s\"\n"
1663 device_name, device_count,
1685 "\t\t\t\"NUMBER\": %u,\n"
1686 "\t\t\t\"INDEX\": %d,\n"
1687 "\t\t\t\"LOAD\": 0,\n"
1688 "\t\t\t\"MODEL_LOAD\": 0,\n"
1689 "\t\t\t\"FW_LOAD\": %u,\n"
1690 "\t\t\t\"INST\": 0,\n"
1691 "\t\t\t\"MAX_INST\": 0,\n"
1692 "\t\t\t\"MEM\": 0,\n"
1693 "\t\t\t\"CRITICAL_MEM\": 0,\n"
1694 "\t\t\t\"SHARE_MEM\": %u,\n"
1695 "\t\t\t\"P2P_MEM\": 0,\n"
1696 "\t\t\t\"DEVICE\": \"%s\",\n"
1697 "\t\t\t\"L_FL2V\": \"%s\",\n"
1698 "\t\t\t\"N_FL2V\": \"%s\",\n"
1699 "\t\t\t\"FR\": \"%.8s\",\n"
1700 "\t\t\t\"N_FR\": \"%.8s\""
1702 ",\n\t\t\t\"NUMA_NODE\": %d,\n"
1703 "\t\t\t\"PCIE_ADDR\": \"%s\"\n"
1710 device_name, device_count,
1736 printf(
"%s", output_buf.
str_buf);
1743 bool has_written_start =
false;
1745 unsigned int index, device_count;
1746 int32_t *module_ids;
1747 uint32_t total_contexts;
1749 uint32_t model_load;
1751 char pcie[64] = {0};
1756 char power_consumption[16];
1758 uint16_t namespace_id = 0;
1766 int32_t *extra_temp_per_index = NULL;
1767 uint32_t *extra_power_per_index = NULL;
1783 if (!has_written_start)
1786 has_written_start =
true;
1793 for (index = 0; index < device_count; index++)
1801 device_name, detail, detail_data_v1))
1840 "\t\t\"NUMBER\": %u,\n"
1841 "\t\t\"INDEX\": %d,\n"
1842 "\t\t\"LOAD\": %u,\n"
1843 "\t\t\"LOAD-ALL\": %u,\n"
1844 "\t\t\"MODEL_LOAD\": %u,\n"
1845 "\t\t\"MODEL_LOAD-ALL\": %u,\n"
1846 "\t\t\"FW_LOAD\": %u,\n"
1847 "\t\t\"INST\": %u,\n"
1848 "\t\t\"INST-ALL\": %u,\n"
1849 "\t\t\"MAX_INST\": %d,\n"
1850 "\t\t\"MEM\": %u,\n"
1851 "\t\t\"CRITICAL_MEM\": %u,\n"
1852 "\t\t\"SHARE_MEM\": %u,\n"
1853 "\t\t\"P2P_MEM\": %u,\n"
1854 "\t\t\"DEVICE\": \"%s\",\n"
1855 "\t\t\"L_FL2V\": \"%s\",\n"
1856 "\t\t\"N_FL2V\": \"%s\",\n"
1857 "\t\t\"FR\": \"%.8s\",\n"
1858 "\t\t\"N_FR\": \"%.8s\""
1860 ",\n\t\t\"NUMA_NODE\": %d,\n"
1861 "\t\t\"PCIE_ADDR\": \"%s\""
1888 "\t\t\"NUMBER\": %u,\n"
1889 "\t\t\"INDEX\": %d,\n"
1890 "\t\t\"LOAD\": %u,\n"
1891 "\t\t\"MODEL_LOAD\": %u,\n"
1892 "\t\t\"FW_LOAD\": %u,\n"
1893 "\t\t\"INST\": %u,\n"
1894 "\t\t\"MAX_INST\": %d,\n"
1895 "\t\t\"MEM\": %u,\n"
1896 "\t\t\"CRITICAL_MEM\": %u,\n"
1897 "\t\t\"SHARE_MEM\": %u,\n"
1898 "\t\t\"P2P_MEM\": %u,\n"
1899 "\t\t\"DEVICE\": \"%s\",\n"
1900 "\t\t\"L_FL2V\": \"%s\",\n"
1901 "\t\t\"N_FL2V\": \"%s\",\n"
1902 "\t\t\"FR\": \"%.8s\",\n"
1903 "\t\t\"N_FR\": \"%.8s\""
1905 ",\n\t\t\"NUMA_NODE\": %d,\n"
1906 "\t\t\"PCIE_ADDR\": \"%s\""
1931 ",\n\t\t\"TEMP\": %d,\n"
1932 "\t\t\"POWER\": \"%s\"",
1944 namespace_id = ns_vf_id.
ns_id;
1956 ",\n\t\t\"QOS MODE\": %u,\n"
1957 "\t\t\"QOS NS\": %u,\n"
1958 "\t\t\"QOS ALLOW\": %.1f,\n"
1959 "\t\t\"QOS OPMAX\": %.1f",
1962 (qos_mode == 0 ? 0 : qos_ns_info.
fAllowance),
1963 (qos_mode == 0 ? 0 :_opmax)
1974 if (index < device_count - 1)
2016 printf(
"%s", output_buf.
str_buf);
2022 extra_temp_per_index = (int32_t *)calloc(device_count,
sizeof(int32_t));
2023 extra_power_per_index = (uint32_t *)calloc(device_count,
sizeof(uint32_t));
2024 if (!extra_temp_per_index || !extra_power_per_index)
2026 fprintf(stderr,
"ERROR: calloc() failed for extra info arrays\n");
2027 if (extra_temp_per_index) free(extra_temp_per_index);
2028 if (extra_power_per_index) free(extra_power_per_index);
2031 g_temp_load = (uint32_t*)calloc(device_count,
sizeof(uint32_t));
2034 fprintf(stderr,
"ERROR: calloc() failed for g_temp_load\n");
2037 g_temp_pload = (uint32_t*)calloc(device_count,
sizeof(uint32_t));
2040 fprintf(stderr,
"ERROR: calloc() failed for g_temp_pload\n");
2046 fprintf(stderr,
"ERROR: calloc() failed for g_temp_pthroughput\n");
2052 fprintf(stderr,
"ERROR: calloc() failed for g_temp_sharemem\n");
2060 for (index = 0; index < device_count; index++)
2069 device_name, detail, detail_data_v1))
2079 "ERROR: ni_query_nvme_status() returned %d for %s:%s:%d\n",
2115 "\t\t\"NUMBER\": %u,\n"
2116 "\t\t\"INDEX\": %d,\n"
2117 "\t\t\"LOAD\": 0,\n"
2118 "\t\t\"MODEL_LOAD\": 0,\n"
2119 "\t\t\"FW_LOAD\": %u,\n"
2120 "\t\t\"INST\": 0,\n"
2121 "\t\t\"MAX_INST\": 0,\n"
2123 "\t\t\"CRITICAL_MEM\": 0,\n"
2124 "\t\t\"SHARE_MEM\": %u,\n"
2125 "\t\t\"PCIE_THROUGHPUT\": %.1f,\n"
2126 "\t\t\"P2P_MEM\": 0,\n"
2127 "\t\t\"DEVICE\": \"%s\",\n"
2128 "\t\t\"L_FL2V\": \"%s\",\n"
2129 "\t\t\"N_FL2V\": \"%s\",\n"
2130 "\t\t\"FR\": \"%.8s\",\n"
2131 "\t\t\"N_FR\": \"%.8s\""
2133 ",\n\t\t\"NUMA_NODE\": %d,\n"
2134 "\t\t\"PCIE_ADDR\": \"%s\""
2155 "\t\t\"NUMBER\": %u,\n"
2156 "\t\t\"INDEX\": %d,\n"
2157 "\t\t\"LOAD\": 0,\n"
2158 "\t\t\"MODEL_LOAD\": 0,\n"
2159 "\t\t\"FW_LOAD\": %u,\n"
2160 "\t\t\"INST\": 0,\n"
2161 "\t\t\"MAX_INST\": 0,\n"
2163 "\t\t\"CRITICAL_MEM\": 0,\n"
2164 "\t\t\"SHARE_MEM\": %u,\n"
2165 "\t\t\"P2P_MEM\": 0,\n"
2166 "\t\t\"DEVICE\": \"%s\",\n"
2167 "\t\t\"L_FL2V\": \"%s\",\n"
2168 "\t\t\"N_FL2V\": \"%s\",\n"
2169 "\t\t\"FR\": \"%.8s\",\n"
2170 "\t\t\"N_FR\": \"%.8s\""
2172 ",\n\t\t\"NUMA_NODE\": %d,\n"
2173 "\t\t\"PCIE_ADDR\": \"%s\""
2191 ni_sprintf(power_consumption, 16,
"%umW", extra_power_per_index[index]);
2194 ",\n\t\t\"TEMP\": %d,\n"
2195 "\t\t\"POWER\": \"%s\"\n"
2198 (extra_power_per_index[index] + 1) ? power_consumption :
"N/A");
2204 if (index < device_count - 1)
2231 printf(
"%s", output_buf.
str_buf);
2238 int index, instance_count;
2240 unsigned int module_count;
2242 int32_t *module_id_arr = NULL;
2252 module_type != max_device_type;
2266 strcat_dyn_buf(&output_buf,
"Num %ss: %u\n", module_name, module_count);
2274 "%-5s %-7s %-9s %-5s %-7s %-8s %-4s %-5s %-6s %-5s %-14s %-20s\n",
"INDEX",
2275 "AvgCost",
"FrameRate",
"IDR",
"InFrame",
"OutFrame",
"fps",
"Width",
"Height",
2276 "SID",
"DEVICE",
"NAMESPACE");
2281 "%-5s %-7s %-9s %-5s %-7s %-8s %-5s %-6s %-5s %-14s %-20s\n",
"INDEX",
2282 "AvgCost",
"FrameRate",
"IDR",
"InFrame",
"OutFrame",
"Width",
"Height",
2283 "SID",
"DEVICE",
"NAMESPACE");
2291 "%-5s %-7s %-9s %-5s %-7s %-7s %-8s %-4s %-10s %-10s %-5s %-6s %-9s %-5s %-14s %-20s\n",
"INDEX",
2292 "AvgCost",
"FrameRate",
"IDR",
"UserIDR",
"InFrame",
"OutFrame",
"fps",
"BR",
"AvgBR",
"Width",
"Height",
2293 "Format",
"SID",
"DEVICE",
"NAMESPACE");
2298 "%-5s %-7s %-9s %-5s %-7s %-7s %-8s %-10s %-10s %-5s %-6s %-9s %-5s %-14s %-20s\n",
"INDEX",
2299 "AvgCost",
"FrameRate",
"IDR",
"UserIDR",
"InFrame",
"OutFrame",
"BR",
"AvgBR",
"Width",
"Height",
2300 "Format",
"SID",
"DEVICE",
"NAMESPACE");
2306 "%-5s %-4s %-10s %-4s %-4s %-9s %-7s %-14s\n",
"INDEX",
2307 "LOAD",
"MODEL_LOAD",
"INST",
"MEM",
"SHARE_MEM",
"P2P_MEM",
2311 for (i = 0; i < module_count; i++)
2319 module_name, detail, detail_data_v1))
2327 if(previous_detail_data_p && checkInterval)
2329 if(previous_detail_data_p[module_type][i].sInstDetailStatus[index].ui16FrameRate)
2334 "%-5d %-7d %-9d %-5u %-7d %-8d %-4d %-5d %-6d %-5s %-14s %-20s\n",
2341 (detail_data_v1->
sInstDetailStatus[index].
ui32NumOutFrame - previous_detail_data_p[module_type][i].sInstDetailStatus[index].ui32NumOutFrame) / checkInterval,
2351 "%-5d %-7d %-9d %-5u %-7d %-7d %-8d %-4d %-10d %-10d %-5d %-6d %-9s %-5s %-14s %-20s\n",
2359 (detail_data_v1->
sInstDetailStatus[index].
ui32NumOutFrame - previous_detail_data_p[module_type][i].sInstDetailStatus[index].ui32NumOutFrame) / checkInterval,
2376 "%-5d %-7d %-9d %-5u %-7d %-8d %-5d %-6d %-5s %-14s %-20s\n",
2392 "%-5d %-7d %-9d %-5u %-7d %-7d %-8d %-10d %-10d %-5d %-6d %-9s %-5s %-14s %-20s\n",
2412 if(previous_detail_data_p)
2422 "%-5d %-4u %-10s %-4u %-4u %-9u %-7u %-14s\n",
2439 "%-5d %-4u %-10u %-4u %-4u %-9u %-7u %-14s\n",
2458 free(module_id_arr);
2462 printf(
"%s", output_buf.
str_buf);
2469 unsigned int index, device_count;
2470 int32_t *module_ids;
2475 char power_consumption[16];
2476 int instance_count = 0;
2479 unsigned int num_gen3_mismatch = 0;
2485 bool has_qos_data =
false;
2486 char qos_str[64] = {0};
2487 uint16_t namespace_id = 0;
2499 printf(
"%s", output_buf.
str_buf);
2504 for (index = 0; index < device_count; index++)
2507 if (!p_device_context)
2514 if (
device_handles[xcoder_device_type][module_id] != NI_INVALID_DEVICE_HANDLE)
2523 if (p_session_context->
device_handle != NI_INVALID_DEVICE_HANDLE)
2530 if (p_session_context->
device_handle == NI_INVALID_DEVICE_HANDLE)
2535 "ERROR: ni_device_open2() failed for %s: %s\n",
2559 namespace_id = ns_vf_id.
ns_id;
2565 has_qos_data =
true;
2571 if (show_qos_info && has_qos_data)
2573 char _allowance[16];
2574 uint8_t qos_mode = (uint8_t)(qos_header.
ui16QosState & 0xFF);
2576 snprintf(qos_str,
sizeof(qos_str),
" %-9u %-7u %-10s %-8.1f",
2579 (qos_mode == 0) ?
"N/A" : (snprintf(_allowance,
sizeof(_allowance),
"%.1f", qos_ns_info.
fAllowance), _allowance),
2580 (qos_mode == 0 ? 0 :_opmax));
2586 "%-4s %-8s %-8s %-14s %s\n",
"TEMP",
"POWER",
"FLAVOR",
"DEVICE",
2587 show_qos_info ?
" QOS_MODE QOS_NS QOS_ALLOW QOS_OPMAX" :
"");
2589 "%-4d %-8s %-8c %-14s %s\n",
2598 if (instance_count == 0)
2601 "%-8s %-8s %-8s %-8s %-8.8s %-20.8s %s\n",
"INDEX",
"TEMP",
"POWER",
"FLAVOR",
"FR",
"SN",
2602 show_qos_info ?
"QOS_MODE QOS_NS QOS_ALLOW QOS_OPMAX" :
"");
2605 "%-8d %-8d %-8s %-8c %-8.8s %-8.*s %s\n",
2618 gen3_mismatch_index[num_gen3_mismatch++] = index;
2626 if (num_gen3_mismatch > 0)
2628 char index_list[128] = {0};
2630 for (
unsigned int i = 0; i < num_gen3_mismatch && len <
sizeof(index_list) - 4; i++)
2632 len += snprintf(index_list + len,
sizeof(index_list) - len,
2633 "%s%u", (i > 0) ?
", " :
"", gen3_mismatch_index[i]);
2636 "This system supports Gen4 PCIe speeds, but the following Quadra cards are "
2637 "currently running firmware that only supports PCIe Gen3 (Index: %s). "
2638 "All Quadra VPUs on this system can be firmware upgraded to support "
2639 "PCIe Gen 4 speeds, please update the firmware on each Quadra card to "
2640 "the default firmware flavor.\n",
2646 printf(
"%s", output_buf.
str_buf);
2653 setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
2655 int skip_init_rsrc = 0;
2656 int should_match_rev = 1;
2663 time_t startTime = {0}, now = {0};
2664 int timeout_seconds = 0;
2665 struct tm *ltime = NULL;
2667 long long time_diff_hours, time_diff_minutes, time_diff_seconds;
2672 bool fw_log_dump =
false;
2673 bool core_reset_log_dump =
false;
2675 int refresh_device_pool = 1;
2676 bool is_first_query =
true;
2678 int show_qos_info = 0;
2681 SetConsoleCtrlHandler(console_ctrl_handler, TRUE);
2683 setup_signal_handler();
2687 while ((opt =
getopt(argc, argv,
"n:o:D:C:k:R:rt:Sl:hvdq")) != -1)
2693 if (!strcmp(
optarg,
"json"))
2697 else if (!strcmp(
optarg,
"simple"))
2701 else if (!strcmp(
optarg,
"text"))
2705 else if (!strcmp(
optarg,
"full"))
2709 else if (!strcmp(
optarg,
"json1"))
2713 else if (!strcmp(
optarg,
"json2"))
2717 else if (!strcmp(
optarg,
"extra"))
2723 fprintf(stderr,
"Error: unknown selection for outputFormat: %s\n",
optarg);
2736 if (core_reset_log_dump)
2745 should_match_rev = 0;
2749 printf(
"Timeout will be set %d\n", timeout_seconds);
2760 fprintf(stderr,
"FATAL: invalid log level selected: %s\n",
optarg);
2769 printf(
"-------- ni_rsrc_mon v%s --------\n"
2770 "The ni_rsrc_mon program provides a real-time view of NETINT Quadra resources\n"
2771 "running on the system.\n"
2773 "Usage: ni_rsrc_mon [OPTIONS]\n"
2774 "-n Specify reporting interval in one second interval. If 0 or no selection,\n"
2775 " report only once.\n"
2777 "-R Specify if refresh devices on host in each monitor interval.\n"
2778 " If 0, only refresh devices at the start.\n"
2780 "-o Output format. [text, simple, full, json, json1, json2, extra]\n"
2782 "-D Dump firmware logs to current directory. Default: 0(not dump fw log).\n"
2783 "-C Dump firmware core reset logs to current directory. Default: 0(not dump fw log).\n"
2784 "-k Specify to dump which card's firmware logs.\n"
2785 " Default: -1(dump fw log of all cards).\n"
2786 "-r Initialize Quadra device regardless firmware release version to\n"
2787 " libxcoder version compatibility.\n"
2788 " Default: only initialize devices with compatible firmware version.\n"
2789 "-t Set timeout time in seconds for device polling. Program will exit with\n"
2790 " failure if timeout is reached without finding at least one device. If 0 or\n"
2791 " no selection, poll indefinitely until a Quadra device is found.\n"
2793 "-S Skip init_rsrc.\n"
2794 "-d Print detailed information for decoder/encoder in text and json formats.\n"
2795 "-l Set loglevel of libxcoder API.\n"
2796 " [none, fatal, error, info, debug, trace]\n"
2798 "-q Show QoS information.\n"
2799 "-h Open this help message.\n"
2800 "-v Print version info.\n"
2802 "Simple output shows the maximum firmware load amongst the subsystems on the\n"
2805 "Reporting columns for text output format\n"
2806 "INDEX index number used by resource manager to identify the resource\n"
2807 "LOAD realtime load given in percentage. This value is max of VPU and FW load reported in full output format\n"
2808 "MODEL_LOAD estimated load based on framerate and resolution\n"
2809 "INST number of job instances\n"
2810 "MEM usage of memory by the subsystem\n"
2811 "SHARE_MEM usage of memory shared across subsystems on the same device\n"
2812 "P2P_MEM usage of memory by P2P\n"
2813 "DEVICE path to NVMe device file handle\n"
2814 "NAMESPACE path to NVMe namespace file handle\n"
2815 "Additional information only in text(Default) mode \n"
2816 "TEMP current temperature (degrees Celsius)\n"
2817 "POWER current power(mW), N/A when query power not supported\n"
2818 "FLAVOR current Flavor, N/A when query flavor not supported\n"
2819 "FR current firmware revision\n"
2820 "SN serial number of the Quadra device\n"
2822 "Additional reporting columns for full output format\n"
2823 "VPU same as LOAD in JSON outputs\n"
2825 "TOTAL same as MEM\n"
2826 "CRITICAL usage of memory considered critical\n"
2827 "L_FL2V last ran firmware loader 2 version\n"
2828 "N_FL2V nor flash firmware loader 2 version\n"
2829 "FR current firmware revision\n"
2830 "N_FR nor flash firmware revision\n"
2831 "Unique field PCIe_Card2Host_Gbps for PCIE throughput from card to host in GBps(Values in steps of 100 Mbps)\n"
2833 "Additional reporting columns for full JSON formats\n"
2835 "FW_LOAD system load\n"
2837 "Extra output shows TEMP and POWER and FLAVOR of the Quadra device \n",
2841 printf(
"Release ver: %s\n"
2851 fprintf(stderr,
"FATAL: unknown option '-%c'\n", opt);
2854 fprintf(stderr,
"FATAL: unknown option character '\\x%x'\n", opt);
2861 fprintf(stderr,
"FATAL: option '-%c' lacks arg\n", opt);
2864 fprintf(stderr,
"FATAL: unhandled option\n");
2869 if(checkInterval > 0 && printFormat ==
FMT_JSON)
2871 fprintf(stderr,
"EXIT: -o json cannot use with -n params\n");
2875 if ((argc <= 2) && (
optind == 1))
2890 fprintf(stderr,
"FATAL: cannot allocate momory for ni_session_context_t\n");
2895 if (!skip_init_rsrc && (ret =
ni_rsrc_init(should_match_rev,timeout_seconds)) != 0)
2899 fprintf(stderr,
"FATAL: NI resource unavailable\n");
2900#if defined(__linux__)
2903 fprintf(stderr,
"Proceeding to dump firmware logs as root\n");
2906 fprintf(stderr,
"This operation requires root (sudo). Please rerun: sudo %s \n", argv[0]);
2909 int rc = ni_rsrc_log_dump(
".", core_reset_log_dump);
2911 fprintf(stderr,
"Firmware log dump: all devices successful.\n");
2913 fprintf(stderr,
"Firmware log dump: No Quadra devices found. Nothing to dump.\n");
2915 fprintf(stderr,
"Firmware log dump: One or more device logs failed to dump. Check previous error messages for details.\n");
2917 fprintf(stderr,
"Firmware log dump: Unexpected error, return code %d\n", rc);
2924 fprintf(stderr,
"FATAL: cannot access NI resource\n");
2933 fprintf(stderr,
"FATAL: cannot get devices info\n");
2940 printf(
"**************************************************\n");
2952 startTime = time(NULL);
2957 if(previous_detail_data == NULL)
2959 fprintf(stderr,
"FATAL: Allocate buffer fail\n");
2963 memset((
void *)previous_detail_data, 0, allocate_size);
2968 struct tm temp_time;
2972 strftime(buf,
sizeof(buf),
"%c", ltime);
2974 time_diff_seconds = (
long long)difftime(now, startTime);
2975 time_diff_minutes = time_diff_seconds / 60;
2976 time_diff_hours = time_diff_minutes / 60;
2979 if (is_first_query || refresh_device_pool)
2986 printf(
"%s up %02lld" ":%02lld" ":%02lld" " v%s\n", buf, time_diff_hours, time_diff_minutes % 60, time_diff_seconds % 60,
2993 if (WAIT_ABANDONED == WaitForSingleObject(p_device_pool->
lock, INFINITE))
2995 fprintf(stderr,
"ERROR: Failed to obtain mutex: %p\n", p_device_pool->
lock);
3000 if ( lockf(p_device_pool->
lock, F_LOCK, 0) )
3002 perror(
"ERROR: cannot lock p_device_pool");
3009 ReleaseMutex((HANDLE)p_device_pool->
lock);
3011 if ( lockf(p_device_pool->
lock, F_ULOCK, 0) )
3013 perror(
"ERROR: cannot unlock p_device_pool");
3017 switch (printFormat)
3021 print_text(coders, p_xCtxt, detail, &detail_data_v1, previous_detail_data, checkInterval);
3032 print_json(coders, p_xCtxt, detail, &detail_data_v1);
3037 print_json1(coders, p_xCtxt, 0, &detail_data_v1, 1);
3047 print_json1(coders, p_xCtxt, 0, &detail_data_v1, 2);
3059 is_first_query =
false;
3063 printf(
"**************************************************\n");
3068 if (checkInterval == 0)
3080 if (WAIT_ABANDONED == WaitForSingleObject(p_device_pool->
lock, INFINITE))
3082 fprintf(stderr,
"ERROR: Failed to obtain mutex: %p\n", p_device_pool->
lock);
3087 if ( lockf(p_device_pool->
lock, F_LOCK, 0) )
3089 perror(
"ERROR: cannot lock p_device_pool");
3094 ReleaseMutex((HANDLE)p_device_pool->
lock);
3096 if ( lockf(p_device_pool->
lock, F_ULOCK, 0) )
3098 perror(
"ERROR: cannot unlock p_device_pool");
3101#if defined(__linux__)
3102 if (core_reset_log_dump)
3104 fprintf(stderr,
"Proceeding to dump firmware logs as root\n");
3107 fprintf(stderr,
"This operation requires root (sudo). Please rerun: sudo %s \n", argv[0]);
3110 int rc = ni_rsrc_log_dump(
".", core_reset_log_dump);
3112 fprintf(stderr,
"Firmware log dump: all devices successful.\n");
3114 fprintf(stderr,
"Firmware log dump: No Quadra devices found. Nothing to dump.\n");
3116 fprintf(stderr,
"Firmware log dump: One or more device logs failed to dump. Check previous error messages for details.\n");
3118 fprintf(stderr,
"Firmware log dump: Unexpected error, return code %d\n", rc);
3139#ifdef __OPENHARMONY__
3140 system(
"chmod -R 777 /dev/shm/");
3141#ifdef XCODER_LINUX_VIRTIO_DRIVER_ENABLED
3142 system(
"chmod 777 /dev/block/vd* 2>/dev/null");
3144#elif defined(_ANDROID)
3145 system(
"chmod -R 777 /dev/shm/");
3146 system(
"chmod 777 /dev/block/nvme* 2>/dev/null");
3147 system(
"chmod 777 /dev/nvme* 2>/dev/null");
3148 property_set(
"ni_rsrc_init_completed",
"yes");
3152 if(checkInterval && previous_detail_data)
3154 free(previous_detail_data);
#define NI_XCODER_REVISION_API_MAJOR_VER_IDX
#define NI_MAX_DEVICE_CNT
#define NI_XCODER_REVISION
#define LIBXCODER_API_VERSION
#define NI_MAX_DEVICE_NAME_LEN
#define NI_MAX_CONTEXTS_PER_HW_INSTANCE
@ NI_DEVICE_TYPE_XCODER_MAX
#define GET_XCODER_DEVICE_TYPE(t)
@ NI_RETCODE_ERROR_RESOURCE_UNAVAILABLE
#define IS_XCODER_DEVICE_TYPE(t)
ni_retcode_t ni_query_nvme_status(ni_session_context_t *p_ctx, ni_load_query_t *p_load_query)
Query NVMe load from the device.
ni_retcode_t ni_device_session_query(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query session data from the device - If device_type is valid, will query session data from specified ...
ni_session_context_t * ni_device_session_context_alloc_init(void)
Allocate and initialize a new ni_session_context_t struct.
ni_retcode_t ni_device_session_query_detail_v1(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_v1_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle, ni_device_vf_ns_id_t *p_dev_ns_vf, uint8_t fw_rev[])
Query VF and NS id from device.
ni_retcode_t ni_device_session_query_detail(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
void ni_device_close(ni_device_handle_t device_handle)
Close device and release resources.
ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle, ni_qos_header_info_log_page_t *p_dev_qos_header, uint8_t fw_rev[])
Query QoS information for the device.
ni_retcode_t ni_device_alloc_and_get_firmware_logs(ni_session_context_t *p_ctx, void **p_log_buffer, bool gen_log_file)
Allocate log buffer if needed and retrieve firmware logs from device.
ni_retcode_t ni_query_extra_info(ni_device_handle_t device_handle, ni_device_extra_info_t *p_dev_extra_info, uint8_t fw_rev[])
Query CompositeTemp from device.
ni_device_handle_t ni_device_open2(const char *p_dev, ni_device_mode_t mode)
Open device and return device device_handle if successful.
void ni_device_session_context_clear(ni_session_context_t *p_ctx)
Clear already allocated session context.
ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle, ni_qos_namespace_info_log_page_t *p_dev_qos_ns, uint8_t fw_rev[])
Query QoS information for a specific namespace.
Public definitions for operating NETINT video processing devices for video processing.
struct _ni_instance_mgr_detail_status_v1 ni_instance_mgr_detail_status_v1_t
int getopt(int argc, char *argv[], const char *optstring)
Implementation of getopt() and getopt_long() for Windows environment.
ni_log_level_t arg_to_ni_log_level(const char *arg_str)
Convert terminal arg string to ni_log_level_t.
void ni_log_set_level(ni_log_level_t level)
Set ni_log_level.
#define NI_SW_RELEASE_TIME
int ni_rsrc_get_numa_node(char *device_name)
get linux numa_node
void ni_rsrc_free_device_context(ni_device_context_t *p_device_context)
Free previously allocated device context.
ni_retcode_t ni_rsrc_refresh(int should_match_rev)
Scan and refresh all resources on the host, taking into account hot-plugged and pulled out cards.
void ni_rsrc_free_device_pool(ni_device_pool_t *p_device_pool)
Free all resources taken by the device pool.
Public definitions for managing NETINT video processing devices.
LIB_API ni_device_context_t * ni_rsrc_get_device_context(ni_device_type_t type, int guid)
Allocates and returns a pointer to ni_device_context_t struct based on provided device_type and guid....
LIB_API ni_device_pool_t * ni_rsrc_get_device_pool(void)
Create and return the allocated ni_device_pool_t struct.
LIB_API int ni_rsrc_init(int should_match_rev, int timeout_seconds)
Initialize and create all resources required to work with NETINT NVMe transcoder devices....
int compareInt32_t(const void *a, const void *b)
compare two int32_t for qsort
char * get_pixel_format(ni_device_context_t *p_device_context, int index)
uint32_t * g_temp_pthroughput
#define DYN_STR_BUF_CHUNK_SIZE
uint32_t * g_temp_sharemem
#define MAX_DEVICE_NAME_SIZE
bool open_and_get_log(ni_device_context_t *p_device_context, ni_session_context_t *p_session_context, void **p_log_buffer, bool gen_log_file)
int remove_device_from_saved(ni_device_type_t device_type, int32_t module_id, ni_device_handle_t device_handle)
remove one device from stored device_handles
void print_text(ni_device_queue_t *coders, ni_session_context_t *sessionCtxt, int detail, ni_instance_mgr_detail_status_v1_t *detail_data_v1, ni_instance_mgr_detail_status_v1_t(*previous_detail_data_p)[NI_DEVICE_TYPE_XCODER_MAX], int checkInterval)
struct dyn_str_buf dyn_str_buf_t
int strcat_dyn_buf(dyn_str_buf_t *dyn_str_buf, const char *fmt,...)
Accumulate string data in a dynamically sized buffer. This is useful to separate error messages from ...
void print_full_text(ni_device_queue_t *p_device_queue, ni_session_context_t *p_session_context, int detail, ni_instance_mgr_detail_status_v1_t *detail_data_v1)
bool open_and_query(ni_device_type_t device_type, ni_device_context_t *p_device_context, ni_session_context_t *p_session_context, char *device_name, int detail, ni_instance_mgr_detail_status_v1_t *detail_data_v1)
int argToI(char *numArray)
convert number from argv input to integer if safe
void clear_dyn_str_buf(dyn_str_buf_t *dyn_str_buf)
void print_json_detail(ni_device_queue_t *p_device_queue, ni_session_context_t *p_session_context, ni_instance_mgr_detail_status_v1_t *detail_data_v1)
void print_json1(ni_device_queue_t *p_device_queue, ni_session_context_t *p_session_context, int detail, ni_instance_mgr_detail_status_v1_t *detail_data_v1, int format)
ni_device_handle_t device_handles[NI_DEVICE_TYPE_XCODER_MAX][NI_MAX_DEVICE_CNT]
bool swap_encoder_and_uploader(ni_device_type_t *p_device_type, char *device_name)
void print_extra(ni_device_queue_t *p_device_queue, ni_session_context_t *p_session_context, int internal_call, int show_qos_info)
char * get_session_id(ni_device_context_t *p_device_context, int id)
void dump_fw_log(ni_device_queue_t *coders, ni_session_context_t *sessionCtxt, int devid)
unsigned int get_modules(ni_device_type_t device_type, ni_device_queue_t *p_device_queue, char *device_name, int32_t **module_ids)
void print_json(ni_device_queue_t *p_device_queue, ni_session_context_t *p_session_context, int detail, ni_instance_mgr_detail_status_v1_t *detail_data_v1)
#define ABSOLUTE_TEMP_ZERO
void print_simple_text(ni_device_queue_t *p_device_queue, ni_session_context_t *p_session_context, int detail, ni_instance_mgr_detail_status_v1_t *detail_data_v1)
uint32_t g_xcoder_stop_process
Private definitions used by ni_rsrc_api.cpp for management of NETINT video processing devices.
void get_dev_pcie_addr(char *device_name, char *pcie, char *domain, char *slot, char *dev, char *func)
ni_retcode_t ni_strncpy(char *dest, size_t dmax, const char *src, size_t slen)
ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum)
ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src)
void ni_usleep(int64_t usec)
struct tm * ni_localtime(struct tm *dest, const time_t *src)
int ni_vsprintf(char *dest, const size_t dmax, const char *fmt, va_list args)
int ni_sprintf(char *dest, size_t dmax, const char *fmt,...)
int ni_cmp_fw_api_ver(const char ver1[], const char ver2[])
Compare two 3 character strings containing a FW API version. Handle comparision when FW API version f...
ni_device_info_t * p_device_info
int pcie_gen3_on_gen4_host
uint8_t serial_number[20]
char dev_name[NI_MAX_DEVICE_NAME_LEN]
char blk_name[NI_MAX_DEVICE_NAME_LEN]
uint8_t fl_ver_last_ran[8]
uint8_t fw_rev_nor_flash[8]
uint8_t fl_ver_nor_flash[8]
ni_device_queue_t * p_device_queue
int32_t xcoders[NI_DEVICE_TYPE_XCODER_MAX][NI_MAX_DEVICE_CNT]
uint32_t xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
ni_instance_mgr_detail_status_append_t sInstDetailStatusAppend[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
ni_instance_mgr_detail_status_t sInstDetailStatus[NI_MAX_CONTEXTS_PER_HW_INSTANCE]
uint32_t fw_share_mem_usage
uint32_t fw_p2p_mem_usage
uint32_t fw_video_shared_mem_usage
uint32_t active_hwuploaders
uint32_t fw_video_mem_usage
uint32_t overall_fw_model_load
uint32_t overall_current_load
uint32_t overall_instance_count
ni_device_handle_t device_handle
ni_load_query_t load_query
ni_device_handle_t blk_io_handle
ni_overall_load_query_t overall_load_query