mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-12 13:58:58 -04:00
Fix whitespace.
This commit is contained in:
parent
b00d4c0452
commit
cb927a5173
8
evmap.c
8
evmap.c
@ -691,7 +691,7 @@ event_changelist_del(struct event_base *base, evutil_socket_t fd, short old, sho
|
|||||||
|
|
||||||
As well as checking the current operation we should also check
|
As well as checking the current operation we should also check
|
||||||
the original set of events to make sure were not ignoring
|
the original set of events to make sure were not ignoring
|
||||||
the case where the add operation is present on an event that
|
the case where the add operation is present on an event that
|
||||||
was already set.
|
was already set.
|
||||||
|
|
||||||
If we have a no-op item, we could remove it it from the list
|
If we have a no-op item, we could remove it it from the list
|
||||||
@ -699,19 +699,19 @@ event_changelist_del(struct event_base *base, evutil_socket_t fd, short old, sho
|
|||||||
change when we do the dispatch later is far cheaper than rejuggling
|
change when we do the dispatch later is far cheaper than rejuggling
|
||||||
the array now.
|
the array now.
|
||||||
|
|
||||||
As this stands, it also lets through deletions of events that are
|
As this stands, it also lets through deletions of events that are
|
||||||
not currently set.
|
not currently set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (events & (EV_READ|EV_SIGNAL)) {
|
if (events & (EV_READ|EV_SIGNAL)) {
|
||||||
if (!(change->old_events & (EV_READ | EV_SIGNAL)) &&
|
if (!(change->old_events & (EV_READ | EV_SIGNAL)) &&
|
||||||
(change->read_change & EV_CHANGE_ADD))
|
(change->read_change & EV_CHANGE_ADD))
|
||||||
change->read_change = 0;
|
change->read_change = 0;
|
||||||
else
|
else
|
||||||
change->read_change = EV_CHANGE_DEL;
|
change->read_change = EV_CHANGE_DEL;
|
||||||
}
|
}
|
||||||
if (events & EV_WRITE) {
|
if (events & EV_WRITE) {
|
||||||
if (!(change->old_events & EV_WRITE) &&
|
if (!(change->old_events & EV_WRITE) &&
|
||||||
(change->write_change & EV_CHANGE_ADD))
|
(change->write_change & EV_CHANGE_ADD))
|
||||||
change->write_change = 0;
|
change->write_change = 0;
|
||||||
else
|
else
|
||||||
|
@ -15,7 +15,6 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
#ifdef _EVENT_HAVE_SYS_SOCKET_H
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#endif
|
#endif
|
||||||
@ -32,9 +31,9 @@
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
write_cb(evutil_socket_t fd, short event, void *arg)
|
write_cb(evutil_socket_t fd, short event, void *arg)
|
||||||
{
|
{
|
||||||
printf("write callback. should only see this once\n");
|
printf("write callback. should only see this once\n");
|
||||||
|
|
||||||
/* got what we want remove the event */
|
/* got what we want remove the event */
|
||||||
event_del(*(struct event**)arg);
|
event_del(*(struct event**)arg);
|
||||||
|
|
||||||
@ -48,7 +47,7 @@ write_cb(evutil_socket_t fd, short event, void *arg)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
timeout_cb(evutil_socket_t fd, short event, void *arg)
|
timeout_cb(evutil_socket_t fd, short event, void *arg)
|
||||||
{
|
{
|
||||||
printf("timeout fired, time to end test\n");
|
printf("timeout fired, time to end test\n");
|
||||||
event_del(*(struct event**)arg);
|
event_del(*(struct event**)arg);
|
||||||
return;
|
return;
|
||||||
@ -111,17 +110,17 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* attempt to calculate our cpu usage over the test should be
|
/* attempt to calculate our cpu usage over the test should be
|
||||||
virtually nil */
|
virtually nil */
|
||||||
|
|
||||||
tickspassed = ((((timeEnd.tv_sec - timeBegin.tv_sec) * 1000000.0) +
|
tickspassed = ((((timeEnd.tv_sec - timeBegin.tv_sec) * 1000000.0) +
|
||||||
(timeEnd.tv_usec - timeBegin.tv_usec)) *
|
(timeEnd.tv_usec - timeBegin.tv_usec)) *
|
||||||
((1.0 * CLOCKS_PER_SEC) / 1000000));
|
((1.0 * CLOCKS_PER_SEC) / 1000000));
|
||||||
|
|
||||||
usage = 100.0 * (((int)(ticksEnd-ticksBegin) * 1.0) / tickspassed);
|
usage = 100.0 * (((int)(ticksEnd-ticksBegin) * 1.0) / tickspassed);
|
||||||
|
|
||||||
printf("ticks used=%d, ticks passed=%d, cpu usage=%.2f%%\n",
|
printf("ticks used=%d, ticks passed=%d, cpu usage=%.2f%%\n",
|
||||||
(int)(ticksEnd-ticksBegin),
|
(int)(ticksEnd-ticksBegin),
|
||||||
tickspassed,
|
tickspassed,
|
||||||
usage);
|
usage);
|
||||||
|
|
||||||
if (usage > 50.0) /* way too high */
|
if (usage > 50.0) /* way too high */
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user