aboutsummaryrefslogtreecommitdiff
path: root/src/or/rephist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-03-12 22:48:18 +0000
committerNick Mathewson <nickm@torproject.org>2006-03-12 22:48:18 +0000
commit474c60b7433da2302c35832571f41867714d8f65 (patch)
tree630b53f7fdd65de04d7a8735262221f5d419bf4a /src/or/rephist.c
parentb67a5ba49801a0a4e190036a30cd0b3d622de9ef (diff)
downloadtor-474c60b7433da2302c35832571f41867714d8f65.tar
tor-474c60b7433da2302c35832571f41867714d8f65.tar.gz
Cleanup on time-relaqted constants. New conventions:
1) Surround all constants by (parens), whether we'll be using them in a denominator or not. 2) Express all time periods as products (24*60*60), not as multiplied-out constants (86400). 3) Comments like "(60*60) /* one hour */" are as pointless as comments like "c = a + b; /* set c to the sum of a and b */". Remove them. 4) All time periods should be #defined constants, not given inline. 5) All time periods should have doxygen comments. 6) All time periods, unless specified, are in seconds. It's not necessary to say so. To summarize, the old (lack of) style would allow: #define FOO_RETRY_INTERVAL 60*60 /* one hour (seconds) */ next_try = now + 3600; The new style is: /** How often do we reattempt foo? */ #define FOO_RETRY_INTERVAL (60*60) next_try = now + RETRY_INTERVAL; svn:r6142
Diffstat (limited to 'src/or/rephist.c')
-rw-r--r--src/or/rephist.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 62d07b966..31f0baaf0 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -382,9 +382,14 @@ rep_history_clean(time_t before)
}
}
+/** For how many seconds do we keep track of individual per-second bandwidth
+ * totals? */
#define NUM_SECS_ROLLING_MEASURE 10
-#define NUM_SECS_BW_SUM_IS_VALID (24*60*60) /* one day */
+/** How large are the intervals for with we track and report bandwidth use? */
#define NUM_SECS_BW_SUM_INTERVAL (15*60)
+/** How far in the past do we remember and publish bandwidth use? */
+#define NUM_SECS_BW_SUM_IS_VALID (24*60*60)
+/** How many bandwidth usage intervals do we remember? (derived.) */
#define NUM_TOTALS (NUM_SECS_BW_SUM_IS_VALID/NUM_SECS_BW_SUM_INTERVAL)
/**
@@ -818,7 +823,9 @@ rep_hist_note_used_port(uint16_t port, time_t now)
add_predicted_port(port, now);
}
-#define PREDICTED_CIRCS_RELEVANCE_TIME (3600) /* 1 hour */
+/** For this long after we've seen a request for a given port, assume that
+ * we'll want to make connections to the same port in the future. */
+#define PREDICTED_CIRCS_RELEVANCE_TIME (60*60)
/** Return a pointer to the list of port numbers that
* are likely to be asked for in the near future.