Skip to content

Commit

Permalink
Initial values
Browse files Browse the repository at this point in the history
  • Loading branch information
kala13x committed Aug 12, 2021
1 parent 1e291ce commit 6af5911
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
4 changes: 1 addition & 3 deletions lib/bc-stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,9 +372,7 @@ bool bc_stats::update_net_info()
if (iface.pkts_sent > it->second.pkts_sent && it->second.pkts_sent > 0)
iface.pkts_sent_per_sec = (iface.pkts_sent - it->second.pkts_sent) / _monitoring_interval;

if (!iface.ipaddr.length()) iface.ipaddr = get_iface_ip_addr(iface.name.c_str());

/* Update existing value with copy-assigment */
iface.ipaddr = get_iface_ip_addr(iface.name.c_str());
it->second = iface;
}
else
Expand Down
20 changes: 10 additions & 10 deletions lib/bc-stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ class bc_stats
std::string ipaddr = std::string("");
std::string name = std::string("");

uint64_t bytes_recv_per_sec;
uint64_t bytes_sent_per_sec;
uint64_t pkts_recv_per_sec;
uint64_t pkts_sent_per_sec;

int64_t bytes_recv;
int64_t bytes_sent;
int64_t pkts_recv;
int64_t pkts_sent;
int32_t type;
uint64_t bytes_recv_per_sec = 0;
uint64_t bytes_sent_per_sec = 0;
uint64_t pkts_recv_per_sec = 0;
uint64_t pkts_sent_per_sec = 0;

int64_t bytes_recv = 0;
int64_t bytes_sent = 0;
int64_t pkts_recv = 0;
int64_t pkts_sent = 0;
int32_t type = 0;
};

static void copy_cpu_info(bc_stats::cpu_info *dst, bc_stats::cpu_info *src);
Expand Down

0 comments on commit 6af5911

Please sign in to comment.