42 #define NET_REFRESH_LATENCY 1000000 44 #define NET_PROC_FILE "/proc/net/dev" 49 #define NET_PROC_MAX_LINE (IFNAMSIZ + 16 * (20 + 1) + 16) 51 #define NET_INVALID_RESULT -1 71 #define NET_INTERFACE_COUNTERS 16 78 {
"rx:bytes",
"receive bytes"},
79 {
"rx:packets",
"receive packets"},
80 {
"rx:errors",
"receive errors"},
81 {
"rx:dropped",
"receive dropped"},
82 {
"rx:fifo",
"receive fifo"},
83 {
"rx:frame",
"receive frame"},
84 {
"rx:compressed",
"receive compressed"},
85 {
"rx:multicast",
"receive multicast"},
87 {
"tx:bytes",
"transmit bytes"},
88 {
"tx:packets",
"transmit packets"},
89 {
"tx:errors",
"transmit errors"},
90 {
"tx:dropped",
"transmit dropped"},
91 {
"tx:fifo",
"transmit fifo"},
92 {
"tx:colls",
"transmit colls"},
93 {
"tx:carrier",
"transmit carrier"},
94 {
"tx:compressed",
"transmit compressed"},
118 SUBDBG(
"Can't find %s, are you sure the /proc file-system is mounted?\n",
124 for (
i=0;
i<2;
i++) {
136 retval = strstr(line,
":");
138 SUBDBG(
"Wrong line format <%s>\n", line);
144 while (isspace(*ifname)) { ifname++; }
164 PAPIERROR(
"This shouldn't be possible\n");
204 char *
retval, *ifname, *data;
209 SUBDBG(
"Can't find %s, are you sure the /proc file-system is mounted?\n",
215 for (
i=0;
i<2;
i++) {
227 retval = strstr(line,
":");
229 SUBDBG(
"Wrong line format <%s>\n", line);
236 while (isspace(*ifname)) { ifname++; }
240 SUBDBG(
"Interface <%s> not found\n", ifname);
243 "%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n",
254 "%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld\n",
266 SUBDBG(
"/proc line with wrong number of fields\n");
386 long long **
events,
int flags )
536 switch ( modifier ) {
548 *EventCode = *EventCode + 1;
589 int index = EventCode;
606 int index = EventCode;
623 int index = EventCode;
645 .description =
"Linux network driver statistics",
655 .fast_real_timer = 0,
656 .fast_virtual_timer = 0,
658 .attach_must_ptrace = 0,
static int _net_ntv_code_to_bits(unsigned int EventCode, hwd_register_t *bits)
long long values[NET_MAX_COUNTERS]
static int _net_shutdown_component(void)
static long long _net_register_start[NET_MAX_COUNTERS]
static int _net_ntv_name_to_code(const char *name, unsigned int *EventCode)
char name[PAPI_MAX_STR_LEN]
papi_vector_t _net_vector
static int _net_stop(hwd_context_t *ctx, hwd_control_state_t *ctl)
static int _net_start(hwd_context_t *ctx, hwd_control_state_t *ctl)
PAPI_component_info_t cmp_info
#define NET_INVALID_RESULT
static int _net_init_control_state(hwd_control_state_t *ctl)
Return codes and api definitions.
static int is_initialized
static int _net_init_component(int cidx)
net component This file contains the source code for a component that enables PAPI-C to access networ...
char events[MAX_EVENTS][BUFSIZ]
char name[PAPI_MAX_STR_LEN]
static int _net_read(hwd_context_t *ctx, hwd_control_state_t *ctl, long long **events, int flags)
static int _net_ntv_code_to_name(unsigned int EventCode, char *name, int len)
static int _net_ntv_code_to_descr(unsigned int EventCode, char *name, int len)
static int _net_shutdown_thread(hwd_context_t *ctx)
char description[PAPI_MAX_STR_LEN]
#define SUBDBG(format, args...)
void PAPIERROR(char *format,...)
static int _net_update_control_state(hwd_control_state_t *ctl, NativeInfo_t *native, int count, hwd_context_t *ctx)
char name[PAPI_MAX_STR_LEN]
static NET_native_event_entry_t * _net_native_events
int _net_reset(hwd_context_t *ctx, hwd_control_state_t *ctl)
static struct temp_event * last
static int generateNetEventList(void)
#define NET_PROC_MAX_LINE
#define NET_INTERFACE_COUNTERS
static struct temp_event * root
long long PAPI_get_real_usec(void)
static int _net_ctl(hwd_context_t *ctx, int code, _papi_int_option_t *option)
#define NET_REFRESH_LATENCY
static const struct net_counters _net_counter_info[NET_INTERFACE_COUNTERS]
static int read_net_counters(long long *values)
static int getInterfaceBaseIndex(const char *ifname)
char description[PAPI_MAX_STR_LEN]
static long long values[NUM_EVENTS]
static int _net_set_domain(hwd_control_state_t *ctl, int domain)
static int _net_ntv_enum_events(unsigned int *EventCode, int modifier)
static int _net_init_thread(hwd_context_t *ctx)
static long long _net_register_current[NET_MAX_COUNTERS]