diff options
author | David Goulet <dgoulet@torproject.org> | 2017-08-31 09:56:55 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2017-09-15 11:40:59 -0400 |
commit | 8424c4f35bd77f5b83113a74c424ca6d12393f1d (patch) | |
tree | 2cacb7f86d6e7ecd0968631606fcd2448c3ced8e /src/or/scheduler_kist.c | |
parent | dde358667d386d2c7b28866b029effa062ab9b6d (diff) | |
download | tor-8424c4f35bd77f5b83113a74c424ca6d12393f1d.tar.gz tor-8424c4f35bd77f5b83113a74c424ca6d12393f1d.zip |
sched: Detect KIST support at compile time
Add a detection for the KIST scheduler in our build system and set
HAVE_KIST_SUPPORT if available.
Adapt the should use kist function with this new compile option.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/scheduler_kist.c')
-rw-r--r-- | src/or/scheduler_kist.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/or/scheduler_kist.c b/src/or/scheduler_kist.c index 97722cb254..98b523f5ae 100644 --- a/src/or/scheduler_kist.c +++ b/src/or/scheduler_kist.c @@ -588,3 +588,26 @@ kist_scheduler_run_interval(const networkstatus_t *ns) return run_interval; } +#ifdef HAVE_KIST_SUPPORT + +/* Return true iff the scheduler subsystem should use KIST. */ +int +scheduler_should_use_kist(void) +{ + int64_t run_interval = kist_scheduler_run_interval(NULL); + log_info(LD_SCHED, "Determined sched_run_interval should be %" PRId64 ". " + "Will%s use KIST.", + run_interval, (run_interval > 0 ? "" : " not")); + return run_interval > 0; +} + +#else /* HAVE_KIST_SUPPORT */ + +int +scheduler_should_use_kist(void) +{ + return 0; +} + +#endif /* HAVE_KIST_SUPPORT */ + |