-
Notifications
You must be signed in to change notification settings - Fork 23
flow_age_stats: Added categorization based on FLOW_END_REASON #234
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: Václav Bartoš <bartos@cesnet.cz>
flow_age_stats/flow_age_stats.c
Outdated
| bin* bins; | ||
| stat* first; | ||
| stat* last; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bin* bins; | |
| stat* first; | |
| stat* last; | |
| bin *bins; | |
| stat *first; | |
| stat *last; |
flow_age_stats/flow_age_stats.c
Outdated
| stat* last; | ||
| uint8_t reason; | ||
| int count; | ||
| struct category_t* next; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| struct category_t* next; | |
| struct category_t *next; |
flow_age_stats/flow_age_stats.c
Outdated
| //declaration of functions | ||
| bin* createNode(uint64_t max, uint64_t count); | ||
| void categorizeIntoCats(category* curr, uint64_t first_diff, uint64_t last_diff, uint8_t end_reason); | ||
| category* createCategory(category* next, uint8_t reason); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| category* createCategory(category* next, uint8_t reason); | |
| category *createCategory(category* next, uint8_t reason); |
flow_age_stats/flow_age_stats.c
Outdated
| void destroyCategory(category* current); | ||
| void printCategories(category* head, int flow_count); | ||
| void outputInFiles(category* head, int flow_count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| void destroyCategory(category* current); | |
| void printCategories(category* head, int flow_count); | |
| void outputInFiles(category* head, int flow_count); | |
| void destroyCategory(category *current); | |
| void printCategories(category *head, int flow_count); | |
| void outputInFiles(category *head, int flow_count); |
flow_age_stats/flow_age_stats.c
Outdated
| fprintf(stderr, "Error: Input template could not be created.\n"); | ||
| return -1; | ||
| } | ||
| if(endReas == 5){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if(endReas == 5){ | |
| if (endReas == 5){ |
flow_age_stats/flow_age_stats.c
Outdated
| current = current->next; | ||
| } | ||
| current->next = createNode(0, 0); | ||
| category* head = createCategory(NULL, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| category* head = createCategory(NULL, 0); | |
| category *head = createCategory(NULL, 0); |
flow_age_stats/flow_age_stats.c
Outdated
| if(head == NULL){ | ||
| destroyCategory(head); | ||
| } | ||
| category* curr = head; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| category* curr = head; | |
| category *curr = head; |
flow_age_stats/flow_age_stats.c
Outdated
| } | ||
| else{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | |
| else{ | |
| } else { |
flow_age_stats/flow_age_stats.c
Outdated
|
|
||
|
|
||
| //should be outputed to file if specified | ||
| if (file == 1){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (file == 1){ | |
| if (file == 1) { |
flow_age_stats/flow_age_stats.c
Outdated
|
|
||
| // clean categories | ||
| while (head != NULL){ | ||
| category* next = head->next; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| category* next = head->next; | |
| category *next = head->next; |
flow_age_stats/flow_age_stats.c
Outdated
| * @param count counts inside the Node are initialized to this value | ||
| */ | ||
| bin* createNode(uint64_t max, uint64_t count){ | ||
| bin* new_node = (bin*)malloc(sizeof(bin)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| bin* new_node = (bin*)malloc(sizeof(bin)); | |
| bin *new_node = (bin *) malloc(sizeof(bin)); |
flow_age_stats/flow_age_stats.c
Outdated
| category* createCategory(category* next, uint8_t reason){ | ||
| category* newCat = (category*)malloc(sizeof(category)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| category* createCategory(category* next, uint8_t reason){ | |
| category* newCat = (category*)malloc(sizeof(category)); | |
| category *createCategory(category *next, uint8_t reason) | |
| { | |
| category *newCat = (category *) malloc(sizeof(category)); |
flow_age_stats/flow_age_stats.c
Outdated
| current->next = createNode(0, 0); | ||
|
|
||
| //creating stat structs | ||
| newCat->first = (stat*)malloc(sizeof(stat)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| newCat->first = (stat*)malloc(sizeof(stat)); | |
| newCat->first = (stat *) malloc(sizeof(stat)); |
flow_age_stats/flow_age_stats.c
Outdated
| newCat->first->min = UINT64_MAX; | ||
| newCat->first->max = 0; | ||
|
|
||
| newCat->last = (stat*)malloc(sizeof(stat)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| newCat->last = (stat*)malloc(sizeof(stat)); | |
| newCat->last = (stat *) malloc(sizeof(stat)); |
flow_age_stats/flow_age_stats.c
Outdated
| * | ||
| * @param current category to be destroyed | ||
| */ | ||
| void destroyCategory(category* current){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| void destroyCategory(category* current){ | |
| void destroyCategory(category *current) | |
| { |
flow_age_stats/flow_age_stats.c
Outdated
| * @param current category to be destroyed | ||
| */ | ||
| void destroyCategory(category* current){ | ||
| if(current == NULL){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if(current == NULL){ | |
| if (current == NULL) { |
|
There are too many coding style issues, please improve the code according to https://nemea.liberouter.org/developer/coding-style-c |
Module can now output statistics and graphs for each value of FLOW_END_REASON separately.