Skip to content

neper: fix histogram printing in csv files. #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
*.csv
*.log
*.o
tcp_crr
tcp_rr
tcp_stream
udp_rr
udp_stream
11 changes: 4 additions & 7 deletions rr.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

#define NEPER_EPOLL_MASK (EPOLLHUP | EPOLLRDHUP | EPOLLERR)

static const int MILLION = 1000000;

typedef ssize_t (*rr_send_t)(struct flow *, const char *, size_t, int);
typedef ssize_t (*rr_recv_t)(struct flow *, char *, size_t);

Expand Down Expand Up @@ -455,18 +453,17 @@ static void rr_print_snap(struct thread *t, int flow_index,
if (snap && csv) {
const struct rr_snap_opaque *rso = (void *)&snap->opaque;

fprintf(csv, ",%f,%f,%f,%f",
rso->min / MILLION, rso->mean / MILLION,
rso->max / MILLION, rso->stddev / MILLION);
fprintf(csv, ",%.9f,%.9f,%.9f,%.9f",
rso->min, rso->mean, rso->max, rso->stddev);

if (t->percentiles) {
const struct options *opts = t->opts;
int i, j = 0;

for (i = 0; i < PER_INDEX_COUNT; i++)
if (percentiles_chosen(&opts->percentiles, i))
fprintf(csv, ",%f",
rso->percentile[j++] / MILLION);
fprintf(csv, ",%.9f",
rso->percentile[j++]);
}

fprintf(csv, "\n");
Expand Down