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 | |
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')
-rw-r--r-- | src/or/scheduler.c | 11 | ||||
-rw-r--r-- | src/or/scheduler.h | 2 | ||||
-rw-r--r-- | src/or/scheduler_kist.c | 23 |
3 files changed, 24 insertions, 12 deletions
diff --git a/src/or/scheduler.c b/src/or/scheduler.c index b04bdceb40..f02b70793a 100644 --- a/src/or/scheduler.c +++ b/src/or/scheduler.c @@ -215,17 +215,6 @@ get_run_sched_ev(void) return run_sched_ev; } -/* Return true iff the scheduler subsystem should use KIST. */ -int -scheduler_should_use_kist(void) -{ - int64_t run_freq = kist_scheduler_run_interval(); - log_info(LD_SCHED, "Determined sched_run_interval should be %" PRId64 ". " - "Will%s use KIST.", - run_freq, (run_freq > 0 ? "" : " not")); - return run_freq > 0; -} - /* Comparison function to use when sorting pending channels */ MOCK_IMPL(int, scheduler_compare_channels, (const void *c1_v, const void *c2_v)) diff --git a/src/or/scheduler.h b/src/or/scheduler.h index 3932e60490..ce5163b817 100644 --- a/src/or/scheduler.h +++ b/src/or/scheduler.h @@ -116,7 +116,6 @@ MOCK_DECL(void, scheduler_channel_has_waiting_cells, (channel_t *chan)); /********************************* * Defined in scheduler.c *********************************/ -int scheduler_should_use_kist(void); smartlist_t *get_channels_pending(void); struct event *get_run_sched_ev(void); MOCK_DECL(int, scheduler_compare_channels, @@ -156,6 +155,7 @@ MOCK_DECL(int, channel_should_write_to_kernel, MOCK_DECL(void, channel_write_to_kernel, (channel_t *chan)); MOCK_DECL(void, update_socket_info_impl, (socket_table_ent_t *ent)); +int scheduler_should_use_kist(void); scheduler_t *get_kist_scheduler(void); int32_t kist_scheduler_run_interval(const networkstatus_t *ns); 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 */ + |