Skip to content
Snippets Groups Projects
Commit 9c708d97 authored by chafiol's avatar chafiol
Browse files

sverbose

parent 68f03881
No related merge requests found
......@@ -64,6 +64,7 @@ int main(int argc, char **argv){
printf("%ld,", tab[i]);
}
printf("\n");
triInsertion(tab, n);
printf("Insertion : ");
for(int i = 0; i<n; i++){
......@@ -112,6 +113,63 @@ int main(int argc, char **argv){
// free(tab);
}
else if((strcmp(argv[1], "--insertion-verbose") == 0) || strcmp(argv[1], "-iv")== 0){
int n = readToTab(tab, argv[2]);
printf("Base : ");
for(int i = 0; i<n; i++){
printf("%ld,", tab[i]);
}
printf("\n");
data.time = clock();
triInsertionVerbose(tab, n, &data);
long new_time = (double)clock() - data.time;
data.time = new_time;
printf("Insertion : ");
for(int i = 0; i<n; i++){
printf("%ld,", tab[i]);
}
printf("\n");
printData(data);
}
else if((strcmp(argv[1], "--fusion-verbose") == 0) || strcmp(argv[1], "-fv")== 0){
int n = readToTab(tab, argv[2]);
printf("Base : ");
for(int i = 0; i<n; i++){
printf("%ld,", tab[i]);
}
printf("\n");
data.time = clock();
triFusionVerbose(tab, n, &data);
long new_time = (double)clock() - data.time;
data.time = new_time;
printf("Fusion : ");
for(int i = 0; i<n; i++){
printf("%ld,", tab[i]);
}
printf("\n");
printData(data);
}
else if((strcmp(argv[1], "--rapide-verbose") == 0) || strcmp(argv[1], "-rv")== 0){
int n = readToTab(tab, argv[2]);
printf("Base : ");
for(int i = 0; i<n; i++){
printf("%ld,", tab[i]);
}
printf("\n");
data.time = clock();
triInsertionVerbose(tab, n, &data);
long new_time = (double)clock() - data.time;
data.time = new_time;
printf("Rapide : ");
for(int i = 0; i<n; i++){
printf("%ld,", tab[i]);
}
printf("\n");
printData(data);
}
else{
printf("Usage: ./tri <option> <input.txt> f\n");
}
......
File added
......@@ -53,6 +53,8 @@ void fusion(long * A, size_t p, size_t q, size_t r){
}
}
void triFusion(long * A, size_t n){
sousTriFusion(A, 0, n);
}
......
No preview for this file type
......@@ -59,4 +59,12 @@ long* generate_tab(size_t nb, size_t *l){
}
return t;
}
void printData(struct data d){
printf("Time passed : %ld\n", d.time);
printf("Number of comparison : %ld\n", d.comparison);
printf("Number of write : %ld\n", d.write);
printf("Call of fusion : %ld\n", d.ct_fusion);
printf("Call of parsing : %ld\n", d.ct_parse);
}
\ No newline at end of file
......@@ -13,7 +13,7 @@
#include <time.h>
struct data {
time_t time;
long time;
unsigned int write;
unsigned int comparison;
unsigned int ct_fusion;
......@@ -23,5 +23,6 @@ struct data {
int readToTab(long* tab, char* file);
void initData(struct data* d);
long* generate_tab(size_t nb, size_t* l);
void printData(struct data d);
#endif
No preview for this file type
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment