tor  master
Macros | Functions
status.c File Reference

Collect status information and log heartbeat messages. More...

#include "or.h"
#include "circuituse.h"
#include "config.h"
#include "status.h"
#include "nodelist.h"
#include "relay.h"
#include "router.h"
#include "circuitlist.h"
#include "main.h"
#include "rephist.h"
#include "hibernate.h"
#include "statefile.h"
#include "hs_stats.h"
#include "hs_service.h"
#include "dos.h"
#include "geoip.h"
Include dependency graph for status.c:

Macros

#define STATUS_PRIVATE
 
#define FULLNESS_PCT_THRESHOLD   80
 
#define TLS_OVERHEAD_THRESHOLD   15
 

Functions

STATIC int count_circuits (void)
 
STATIC char * secs_to_uptime (long secs)
 
STATIC char * bytes_to_usage (uint64_t bytes)
 
int log_heartbeat (time_t now)
 

Detailed Description

Collect status information and log heartbeat messages.

This module is responsible for implementing the heartbeat log messages, which periodically inform users and operators about basic facts to do with their Tor instance. The log_heartbeat() function, invoked from main.c, is the principle entry point. It collects data from elsewhere in Tor, and logs it in a human-readable format.

Function Documentation

◆ bytes_to_usage()

STATIC char* bytes_to_usage ( uint64_t  bytes)

Take bytes and returns a newly allocated human-readable usage string.

Here is the call graph for this function:

◆ count_circuits()

STATIC int count_circuits ( void  )

Return the total number of circuits.

◆ log_heartbeat()

int log_heartbeat ( time_t  now)

Log a "heartbeat" message describing Tor's status and history so that the user can know that there is indeed a running Tor. Return 0 on success and -1 on failure.

Now, if we are an HS service, log some stats about our usage

◆ secs_to_uptime()

STATIC char* secs_to_uptime ( long  secs)

Take seconds secs and return a newly allocated human-readable uptime string.

Here is the call graph for this function: