Commit 1c1b2239 authored by Nick Mathewson's avatar Nick Mathewson 🦀
Browse files

Merge commit 'karsten/bufferstats-master'

parents aa0cf31c b493a2cc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -21,6 +21,10 @@ Changes in version 0.2.2.1-alpha - 2009-??-??
      transferred bytes per port to disk every 24 hours.  To enable this,
      run configure with the --enable-exit-stats option, and set
      "ExitPortStatistics 1" in your torrc.
    - Relays write statistics on how long cells spend in their circuit
      queues to disk every 24 hours. To enable this, run configure with
      the --enable-buffer-stats option, and set "CellStatistics 1" in your
      torrc.

  o Minor bugfixes
    - Hidden service clients didn't use a cached service descriptor that
+7 −0
Original line number Diff line number Diff line
@@ -99,6 +99,13 @@ if test "$enable_geoip_stats" = "yes"; then
  AC_DEFINE(ENABLE_GEOIP_STATS, 1, [Defined if we try to collect per-country statistics])
fi

AC_ARG_ENABLE(buffer-stats,
     AS_HELP_STRING(--enable-buffer-stats, enable code for relays to collect buffer statistics))

if test "$enable_buffer_stats" = "yes"; then
  AC_DEFINE(ENABLE_BUFFER_STATS, 1, [Defined if we try to collect buffer statistics])
fi

AC_ARG_ENABLE(gcc-warnings,
     AS_HELP_STRING(--enable-gcc-warnings, enable verbose warnings))

+5 −0
Original line number Diff line number Diff line
@@ -447,6 +447,11 @@ circuit_free(circuit_t *circ)
      rend_data_free(ocirc->rend_data);
  } else {
    or_circuit_t *ocirc = TO_OR_CIRCUIT(circ);
#ifdef ENABLE_BUFFER_STATS
    /* Remember cell statistics for this circuit before deallocating. */
    if (get_options()->CellStatistics)
      add_circ_to_buffer_stats(circ, time(NULL));
#endif
    mem = ocirc;
    memlen = sizeof(or_circuit_t);
    tor_assert(circ->magic == OR_CIRCUIT_MAGIC);
+11 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ static config_var_t _option_vars[] = {
  V(BridgePassword,              STRING,   NULL),
  V(BridgeRecordUsageByCountry,  BOOL,     "1"),
  V(BridgeRelay,                 BOOL,     "0"),
  V(CellStatistics,              BOOL,     "0"),
  V(CircuitBuildTimeout,         INTERVAL, "1 minute"),
  V(CircuitIdleTimeout,          INTERVAL, "1 hour"),
  V(ClientDNSRejectInternalAddresses, BOOL,"1"),
@@ -1394,6 +1395,16 @@ options_act(or_options_t *old_options)
  if (options->ExitPortStatistics)
    log_warn(LD_CONFIG, "ExitPortStatistics enabled, but Tor was built "
             "without port statistics support.");
#endif
#ifdef ENABLE_BUFFER_STATS
  if (options->CellStatistics)
    log_notice(LD_CONFIG, "Configured to measure cell statistics. Look "
               "for the buffer-stats file that will first be written to "
               "the data directory in 24 hours from now.");
#else
  if (options->CellStatistics)
    log_warn(LD_CONFIG, "CellStatistics enabled, but Tor was built "
             "without cell statistics support.");
#endif
  /* Check if we need to parse and add the EntryNodes config option. */
  if (options->EntryNodes &&
+11 −0
Original line number Diff line number Diff line
@@ -830,6 +830,9 @@ run_scheduled_events(time_t now)
  static time_t time_to_clean_caches = 0;
  static time_t time_to_recheck_bandwidth = 0;
  static time_t time_to_check_for_expired_networkstatus = 0;
#ifdef ENABLE_BUFFER_STATS
  static time_t time_to_dump_buffer_stats = 0;
#endif
  static time_t time_to_retry_dns_init = 0;
  or_options_t *options = get_options();
  int i;
@@ -957,6 +960,14 @@ run_scheduled_events(time_t now)
    time_to_check_for_expired_networkstatus = now + CHECK_EXPIRED_NS_INTERVAL;
  }

#ifdef ENABLE_BUFFER_STATS
  if (time_to_dump_buffer_stats < now) {
    if (get_options()->CellStatistics && time_to_dump_buffer_stats)
      dump_buffer_stats();
    time_to_dump_buffer_stats = now + DUMP_BUFFER_STATS_INTERVAL;
  }
#endif

  /* Remove old information from rephist and the rend cache. */
  if (time_to_clean_caches < now) {
    rep_history_clean(now - options->RephistTrackTime);
Loading