Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
store the total byte count since a subscription was started
  • Loading branch information
Sam Stenvall authored and perexg committed Sep 2, 2015
1 parent e1695bf commit 50f950c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/subscriptions.c
Expand Up @@ -957,6 +957,7 @@ subscription_done(void)
void subscription_add_bytes_in(th_subscription_t *s, size_t in)
{
atomic_add(&s->ths_bytes_in, in);
atomic_add_u64(&s->ths_total_bytes_in, in);
}

/**
Expand All @@ -965,6 +966,7 @@ void subscription_add_bytes_in(th_subscription_t *s, size_t in)
void subscription_add_bytes_out(th_subscription_t *s, size_t out)
{
atomic_add(&s->ths_bytes_out, out);
atomic_add_u64(&s->ths_total_bytes_out, out);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/subscriptions.h
Expand Up @@ -86,6 +86,8 @@ typedef struct th_subscription {
char *ths_title; /* display title */
time_t ths_start; /* time when subscription started */
int ths_total_err; /* total errors during entire subscription */
uint64_t ths_total_bytes_in; /* total bytes since the subscription started */
uint64_t ths_total_bytes_out; /* total bytes since the subscription started */
int ths_bytes_in; // Reset every second to get aprox. bandwidth (in)
int ths_bytes_out; // Reset every second to get approx bandwidth (out)

Expand Down

0 comments on commit 50f950c

Please sign in to comment.