diff --git a/README.md b/README.md index 5141720..be43e87 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,6 @@ PapiPlot PapiPlot takes the output generated with [Papify](https://github.com/alejoar/papify) and generates graphs that can be used to evaluate the performance of your ORC-Apps. These graphs come served with a generated html where value tables are included for each graph, so you can check the specific value for each point or copy them into an excel/word document. -PapiPlot generates the graphs using **gnuplot**, so make sure you have it installed: -``` -sudo apt-get install gnuplot -``` - If you place the PapiPlot binary inside the **papi-output** dir, you can run it without any arguments: it will generate the graphs with default parameters. Other options available are: ``` -p [path] Set path to the papi-output folder generated with Papify. If not specified, current directory will be used. @@ -25,16 +20,32 @@ If you place the PapiPlot binary inside the **papi-output** dir, you can run it -h Print help ``` +##Compile +PapiPlot generates the graphs using **gnuplot**, so make sure it is installed: +``` +sudo apt-get install gnuplot +``` + +It is possible to quickly compile papiplot using cmake: +``` +$ git clone https://github.com/Papify/papiplot.git +$ cd papiplot/papiplot/ +$ cmake . +$ make +``` + +You can also import the project into eclipse. + ##Examples -An example of an html generated with PapiPlot has been set up at http://alejoar.github.io/papiplot. Note that this is just an example generated with the command `./papiplot` (no parameters) using the data obtained after applying papify to all actions, all actors to the [orc-app RVC](https://github.com/orcc/orc-apps), an app that has some actors with lots of actions, meaning some images are not properly adjusted to make them usable. This can be fixed using the resolution parameters integrated in PapiPlot, an example is shown below. +An example of an html generated with PapiPlot has been set up at http://papify.github.io/papiplot. Note that this is just an example generated with the command `./papiplot` (no parameters) using the data obtained after applying papify to all actions, all actors to the [orc-app RVC](https://github.com/orcc/orc-apps), an app that has some actors with lots of actions, meaning some images are not properly adjusted to make them usable. This can be fixed using the resolution parameters integrated in PapiPlot, an example is shown below. Here's what the graphs look like without labels (`$ ./papiplot -n`) ![Alt text](papiplot/readme/papiplot_overall_.png?raw=true "Optional Title") Sometimes it's possible for an actor to have a huge amount of actions *papified* and everything may look cramped like in the following example: -![cramped!](http://alejoar.github.io/papiplot/papiplot_HevcDecoder_Algo_Parser.png) +![cramped!](http://papify.github.io/papiplot/papiplot_HevcDecoder_Algo_Parser.png) Now that's **awful**! diff --git a/papiplot/readme/annotations_example.png b/papiplot/readme/annotations_example.png new file mode 100644 index 0000000..2d719fb Binary files /dev/null and b/papiplot/readme/annotations_example.png differ diff --git a/papiplot/readme/comp_settings.png b/papiplot/readme/comp_settings.png new file mode 100644 index 0000000..8b6c27d Binary files /dev/null and b/papiplot/readme/comp_settings.png differ diff --git a/papiplot/src/plot.c b/papiplot/src/plot.c index 5327205..31fc1e9 100644 --- a/papiplot/src/plot.c +++ b/papiplot/src/plot.c @@ -470,7 +470,10 @@ void search_and_plot(char *path) { strcat(path_to_csv,"/"); strcat(path_to_csv,pDirent->d_name); data = process_data(path, path_to_csv, pDirent->d_name, path_to_totals); - plot(path, data->proc_file_path, data->actor_name, data->actions_nb, data->actions[0]->events_nb); + if(data->actions_nb == 0) + printf(" no data..\n"); + else + plot(path, data->proc_file_path, data->actor_name, data->actions_nb, data->actions[0]->events_nb); html_actor(htmlfile, data); remove(data->proc_file_path); free(data); @@ -511,8 +514,10 @@ event_acum_for_actor* process_data (char* path_todir, char* path_tofile, char* f //printf("we have %d actions here\n",get_actions_nb_in_file(path_tofile));///////////////////////////////////////////// //get_actions_nb_in_file(path_tofile); int actions_nb=get_actions_nb_in_file(path_tofile); - - actor = malloc(sizeof(event_acum_for_actor)+sizeof(event_acum_for_action*)*(actions_nb));//weird memory is weird.. + if(actions_nb == 0) + actor = malloc(sizeof(event_acum_for_actor)+sizeof(event_acum_for_action*));//weird memory is weird.. + else + actor = malloc(sizeof(event_acum_for_actor)+sizeof(event_acum_for_action*)*(actions_nb)); actor->actor_name = malloc(strlen(actor_name)+1); strcpy(actor->actor_name,actor_name); @@ -541,7 +546,6 @@ event_acum_for_actor* process_data (char* path_todir, char* path_tofile, char* f if(fgets(buf,1500,ofile)==NULL) perror("");//read first line token = strtok(buf,";"); token = strtok(NULL,";");//skip action column (actot name) - for(i=0;iactions[0]->events_nb;i++){ token = strtok(NULL,";"); for(j = 0; j actions_nb; j++){ @@ -551,8 +555,6 @@ event_acum_for_actor* process_data (char* path_todir, char* path_tofile, char* f } } - - int found = -1; int found_actions = 0; int current; @@ -563,47 +565,45 @@ event_acum_for_actor* process_data (char* path_todir, char* path_tofile, char* f totals[i]=0; } - //acumuating structures int result; //borrar - while(fgets(buf,1500,ofile)!=NULL){ - token = strtok(buf,";"); - token = strtok(NULL,";");//read action name - - for(i=0; iactions_nb; i++){ - if(actor->actions[i]->action_name==NULL) - break; - else { - result = strcmp(actor->actions[i]->action_name,token); - if(result==0){ - found = i; + if(actor->actions_nb != 0) { + while(fgets(buf,1500,ofile)!=NULL){ + token = strtok(buf,";"); + token = strtok(NULL,";");//read action name + for(i=0; iactions_nb; i++){ + if(actor->actions[i]->action_name==NULL) break; - } else { + result = strcmp(actor->actions[i]->action_name,token); + if(result==0){ + found = i; + break; + } + else { + } } } - } - if (found == -1){ - //printf("not found, adding action %s\n", token); - actor->actions[found_actions]->action_name = malloc(strlen(token)+1); - strcpy(actor->actions[found_actions]->action_name,token); - } - current = (found == -1)? found_actions++ : found; + if (found == -1){ + //printf("not found, adding action %s\n", token); + actor->actions[found_actions]->action_name = malloc(strlen(token)+1); + strcpy(actor->actions[found_actions]->action_name,token); + } + current = (found == -1)? found_actions++ : found; - for(i = 0; i actions[current]->events_nb; i++){ - token = strtok(NULL,";"); - actor->actions[current]->acumulator[i]->count += get_number(token); - totals[i] += get_number(token); - //printf("adding %s (%llu).. totals[%d] = %llu\n", token, get_number(token), i, totals[i]); - } - found = -1; + for(i = 0; i actions[current]->events_nb; i++){ + token = strtok(NULL,";"); + actor->actions[current]->acumulator[i]->count += get_number(token); + totals[i] += get_number(token); + //printf("adding %s (%llu).. totals[%d] = %llu\n", token, get_number(token), i, totals[i]); + } + found = -1; + } } - - fclose(ofile); //writing events per action @@ -726,6 +726,7 @@ int get_actions_nb_in_file(char* path_tofile){//weird memory allocation... ¿?? if(fgets(buf,1500,ofile)==NULL) perror("");//skip labels lines while(fgets(buf,1500,ofile)!=NULL){ + //printf("buf = %d (%d)\n", buf,strlen(buf)); token = strtok(buf,";"); token = strtok(NULL,";");//read action name @@ -735,7 +736,7 @@ int get_actions_nb_in_file(char* path_tofile){//weird memory allocation... ¿?? break; } - if (found == -1){ + if (found == -1 && token != NULL){ theActions = realloc(theActions, sizeof(char*)*(actions_nb+2)); theActions[actions_nb] = malloc(strlen(token)+1); theActions[actions_nb+1] = malloc(strlen(token)+1); @@ -744,12 +745,10 @@ int get_actions_nb_in_file(char* path_tofile){//weird memory allocation... ¿?? } found = -1; } - fclose(ofile); for(i=0; i