@@ -95,8 +95,14 @@ unsigned int uptime = 0, sleep_usecs = 0;
9595unsigned int lastcheck = 0 ;
9696unsigned long global_timeout = DFLT_TIMEOUT ;
9797
98+ static
9899int ifNumber = 0 ;
99100
101+ #ifdef DEBUG
102+ static
103+ char * implode_result ;
104+ #endif
105+
100106int
101107main (int argc , char * argv [])
102108{
@@ -374,11 +380,17 @@ main(int argc, char *argv[])
374380 if (getenv ("MIBS" ) == NULL )
375381 setenv ("MIBS" , "" , 1 );
376382
383+ #ifdef DEBUG
384+ benchmark_start ("Start SNMP session" );
385+ #endif
377386 if (user )
378387 /* use snmpv3 */
379388 ss = start_session_v3 (& session , user , auth_proto , auth_pass , priv_proto , priv_pass , hostname );
380389 else
381390 ss = start_session (& session , community , hostname );
391+ #ifdef DEBUG
392+ benchmark_end ();
393+ #endif
382394
383395 if (mode == NONBULK ) {
384396 oid_ifp = oid_if_get ;
@@ -428,8 +440,16 @@ main(int argc, char *argv[])
428440 snmp_add_null_var (pdu , lastOid .name , lastOid .name_len );
429441 }
430442
443+ #ifdef DEBUG
444+ implode_result = implode (", " , oid_ifp + count );
445+ benchmark_start ("Send SNMP request for OIDs: %s" , implode_result );
446+ #endif
431447 /* send the request */
432448 status = snmp_synch_response (ss , pdu , & response );
449+ #ifdef DEBUG
450+ benchmark_end ();
451+ free (implode_result );
452+ #endif
433453 if (sleep_usecs )
434454 usleep (sleep_usecs );
435455
@@ -596,8 +616,16 @@ main(int argc, char *argv[])
596616 snmp_add_null_var (pdu , lastOid .name , lastOid .name_len );
597617 }
598618
619+ #ifdef DEBUG
620+ implode_result = implode (", " , oid_aliasp + count );
621+ benchmark_start ("Send SNMP request for OIDs: %s" , implode_result );
622+ #endif
599623 /* send the request */
600624 status = snmp_synch_response (ss , pdu , & response );
625+ #ifdef DEBUG
626+ benchmark_end ();
627+ free (implode_result );
628+ #endif
601629 if (sleep_usecs ) usleep (sleep_usecs );
602630
603631 if (status == STAT_SUCCESS && response -> errstat == SNMP_ERR_NOERROR ) {
@@ -1068,7 +1096,13 @@ main(int argc, char *argv[])
10681096 }
10691097 printf ("\n%*s" , (int )perf .len , perf .text );
10701098
1099+ #ifdef DEBUG
1100+ benchmark_start ("Close SNMP session" );
1101+ #endif
10711102 snmp_close (ss );
1103+ #ifdef DEBUG
1104+ benchmark_end ();
1105+ #endif
10721106
10731107 SOCK_CLEANUP ;
10741108 return ((errorflag )?2 :((warnflag )?1 :0 ));
@@ -1448,7 +1482,15 @@ int create_request(netsnmp_session *ss, struct OIDStruct **OIDpp, char **oid_lis
14481482
14491483 * OIDpp = OIDp ;
14501484
1485+ #ifdef DEBUG
1486+ implode_result = implode (", " , oid_list );
1487+ benchmark_start ("Send SNMP request for OIDs: %s" , implode_result );
1488+ #endif
14511489 status = snmp_synch_response (ss , pdu , response );
1490+ #ifdef DEBUG
1491+ benchmark_end ();
1492+ free (implode_result );
1493+ #endif
14521494 if (sleep_usecs ) usleep (sleep_usecs );
14531495
14541496 if (status == STAT_SUCCESS && (* response )-> errstat == SNMP_ERR_NOERROR ) {
0 commit comments