Summary
Events are deleted before being reinitialized on the next run, so iterations 1-24 are balanced. After the final run, however, all persistent events remain registered and the process calls exit(0) without event_del() or base cleanup.
Affected code
- Repository commit:
477033f938fd47dfecde43c82257cd286d9fa38e
- File:
benchmark/ioevent/libevent/libevent_ioevent_bench.c
- Original scanner location: line 105
Evidence
Source: benchmark/ioevent/libevent/libevent_ioevent_bench.c lines 94-106
94: static struct timeval *
95: run_once(void)
96: {
97: evutil_socket_t *cp, space;
98: long i;
99: static struct timeval ts, te;
100:
101: for (cp = pipes, i = 0; i < num_pipes; i++, cp += 2) {
102: if (event_initialized(&events[i]))
103: event_del(&events[i]);
104: event_set(&events[i], cp[0], EV_READ | EV_PERSIST, read_cb, (void *)(ev_intptr_t) i);
105: event_add(&events[i], NULL);
106: }
Source: benchmark/ioevent/libevent/libevent_ioevent_bench.c lines 196-208
196: long sum = 0;
197: for (i = 0; i < 25; i++) {
198: tv = run_once();
199: if (tv == NULL)
200: exit(1);
201: fprintf(stdout, "%ld\n",
202: tv->tv_sec * 1000000L + tv->tv_usec);
203: sum += tv->tv_sec * 1000000L + tv->tv_usec;
204: }
205: fprintf(stdout, "%s Average : %ld\n", argv[0], sum/25);
206:
207: exit(0);
208: }
Impact
Pending event registrations and their base survive until process termination; this is real but has little runtime impact for this benchmark.
Summary
Events are deleted before being reinitialized on the next run, so iterations 1-24 are balanced. After the final run, however, all persistent events remain registered and the process calls
exit(0)withoutevent_del()or base cleanup.Affected code
477033f938fd47dfecde43c82257cd286d9fa38ebenchmark/ioevent/libevent/libevent_ioevent_bench.cEvidence
Source: benchmark/ioevent/libevent/libevent_ioevent_bench.c lines 94-106
Source: benchmark/ioevent/libevent/libevent_ioevent_bench.c lines 196-208
Impact
Pending event registrations and their base survive until process termination; this is real but has little runtime impact for this benchmark.