Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions timeout.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,20 @@ TIMEOUT_PUBLIC bool timeouts_check(struct timeouts *T, FILE *fp) {
return 1;
} /* timeouts_check() */

#ifdef DEBUG
TIMEOUT_PUBLIC int timeouts_pendings(struct timeouts *T, uint64_t **pendings) {
int i;
if (pendings) {
*pendings = (uint64_t *)malloc(sizeof(uint64_t) * WHEEL_NUM);
for (i = 0; i < WHEEL_NUM; i++) {
(*pendings)[i] = T->pending[i];
}
return WHEEL_NUM;
}
return 0;
} /* timeouts_pendings() */
#endif


#define ENTER \
do { \
Expand Down
6 changes: 6 additions & 0 deletions timeout.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ TIMEOUT_PUBLIC bool timeouts_expired(struct timeouts *);
TIMEOUT_PUBLIC bool timeouts_check(struct timeouts *, FILE *);
/* return true if invariants hold. describes failures to optional file handle. */

#ifdef DEBUG
TIMEOUT_PUBLIC int timeouts_pendings(struct timeouts *, uint64_t **);
/* return timing wheel number. copy pendings of all wheels to malloced memory
* (which need free by yourself). */
#endif

#define TIMEOUTS_PENDING 0x10
#define TIMEOUTS_EXPIRED 0x20
#define TIMEOUTS_ALL (TIMEOUTS_PENDING|TIMEOUTS_EXPIRED)
Expand Down