[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Mark the 1-per-sec update_current_time() call as redundant.



commit c9f07f36bf986f274ac9fc56b5c61bbcc669b22e
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Thu May 3 12:23:55 2018 -0400

    Mark the 1-per-sec update_current_time() call as redundant.
    
    We still do this time update here, since we do it from all
    callbacks, but it is no longer a reason to keep the once-per-second
    callback enabled.
    
    Closes ticket 26009.
---
 changes/ticket26009 | 9 +++++++++
 src/or/main.c       | 6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/changes/ticket26009 b/changes/ticket26009
new file mode 100644
index 000000000..51ada1572
--- /dev/null
+++ b/changes/ticket26009
@@ -0,0 +1,9 @@
+  o Minor features (mainloop):
+   - Move responsibility for
+     keeping track of Tor's uptime
+      from a nce-per-second callback to a callback that is only scheduled as
+      needed.  Once enough items are removed from our once-per-second
+      callback, we can eliminate it entirely to conserve CPU when idle.
+      Closes ticket
+      26009.
+
diff --git a/src/or/main.c b/src/or/main.c
index e82162c39..b6035fa76 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2576,8 +2576,12 @@ second_elapsed_callback(periodic_timer_t *timer, void *arg)
 
   n_libevent_errors = 0;
 
-  /* log_notice(LD_GENERAL, "Tick."); */
   now = time(NULL);
+
+  /* We don't need to do this once-per-second any more: time-updating is
+   * only in this callback _because it is a callback_. It should be fine
+   * to disable this callback, and the time will still get updated.
+   */
   update_current_time(now);
 
   /* the second has rolled over. check more stuff. */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits