MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xstats_display

Function xstats_display

dpdk/app/proc-info/main.c:1941–2002  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1939}
1940
1941static void
1942xstats_display(uint8_t dev_id,
1943 enum rte_event_dev_xstats_mode mode,
1944 uint8_t queue_port_id)
1945{
1946 int ret;
1947 struct rte_event_dev_xstats_name *xstats_names;
1948 uint64_t *ids;
1949 uint64_t *values;
1950 int size;
1951 int i;
1952
1953 size = rte_event_dev_xstats_names_get(dev_id,
1954 mode,
1955 queue_port_id,
1956 NULL, /* names */
1957 NULL, /* ids */
1958 0); /* num */
1959
1960 if (size < 0)
1961 rte_panic("rte_event_dev_xstats_names_get err %d\n", size);
1962
1963 if (size == 0) {
1964 printf(
1965 "No stats available for this item, mode=%d, queue_port_id=%d\n",
1966 mode, queue_port_id);
1967 return;
1968 }
1969
1970 /* Get memory to hold stat names, IDs, and values */
1971 xstats_names = malloc(sizeof(struct rte_event_dev_xstats_name) * (unsigned int)size);
1972 ids = malloc(sizeof(unsigned int) * size);
1973
1974 if (!xstats_names || !ids)
1975 rte_panic("unable to alloc memory for stats retrieval\n");
1976
1977 ret = rte_event_dev_xstats_names_get(dev_id, mode, queue_port_id,
1978 xstats_names, ids,
1979 (unsigned int)size);
1980 if (ret != size)
1981 rte_panic("rte_event_dev_xstats_names_get err %d\n", ret);
1982
1983 values = malloc(sizeof(uint64_t) * size);
1984 if (!values)
1985 rte_panic("unable to alloc memory for stats retrieval\n");
1986
1987 ret = rte_event_dev_xstats_get(dev_id, mode, queue_port_id,
1988 ids, values, size);
1989
1990 if (ret != size)
1991 rte_panic("rte_event_dev_xstats_get err %d\n", ret);
1992
1993 for (i = 0; i < size; i++) {
1994 printf("id %"PRIu64" %s = %"PRIu64"\n",
1995 ids[i], &xstats_names[i].name[0], values[i]);
1996 }
1997
1998 free(values);

Callers 1

eventdev_xstatsFunction · 0.85

Calls 5

mallocFunction · 0.85
rte_event_dev_xstats_getFunction · 0.85
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected