Commit de fin de TD/TP
This commit is contained in:
parent
ca552281c9
commit
8a8fe82b16
70
compterendu.md
Normal file
70
compterendu.md
Normal file
@ -0,0 +1,70 @@
|
||||
# Compte-rendu TP
|
||||
## Test de base :
|
||||
### Commandes :
|
||||
./student_rank 5 5 1
|
||||
gprof ./student_rank
|
||||
|
||||
La fonction "bubblesort" est la fonction la plus appelée et qui a le plus de temps d'exécution.
|
||||
|
||||
|
||||
Flat profile:
|
||||
|
||||
Each sample counts as 0.01 seconds.
|
||||
no time accumulated
|
||||
|
||||
% cumulative self self total
|
||||
time seconds seconds calls Ts/call Ts/call name
|
||||
0.00 0.00 0.00 30 0.00 0.00 bubblesort
|
||||
0.00 0.00 0.00 25 0.00 0.00 find_rank_student
|
||||
0.00 0.00 0.00 10 0.00 0.00 print_array
|
||||
0.00 0.00 0.00 5 0.00 0.00 generate_array
|
||||
0.00 0.00 0.00 2 0.00 0.00 free_array
|
||||
0.00 0.00 0.00 2 0.00 0.00 print_student_array
|
||||
0.00 0.00 0.00 1 0.00 0.00 generate_grades
|
||||
0.00 0.00 0.00 1 0.00 0.00 generate_ranks
|
||||
0.00 0.00 0.00 1 0.00 0.00 sort_students
|
||||
|
||||
## Test avec plus de données :
|
||||
### Commandes :
|
||||
./student_rank 1000 1000 0
|
||||
gprof ./student_rank
|
||||
|
||||
La fonction "bubblesort" est la fonction la plus appelée et qui a le plus de temps d'exécution.
|
||||
|
||||
Flat profile:
|
||||
|
||||
Each sample counts as 0.01 seconds.
|
||||
% cumulative self self total
|
||||
time seconds seconds calls s/call s/call name
|
||||
84.86 8.10 8.10 1001000 0.00 0.00 bubblesort
|
||||
14.21 9.46 1.36 1000000 0.00 0.00 find_rank_student
|
||||
1.00 9.56 0.10 1 0.10 9.56 sort_students
|
||||
0.10 9.57 0.01 1 0.01 0.01 generate_ranks
|
||||
0.00 9.57 0.00 1000 0.00 0.00 generate_array
|
||||
0.00 9.57 0.00 2 0.00 0.00 free_array
|
||||
0.00 9.57 0.00 1 0.00 0.00 generate_grades
|
||||
|
||||
|
||||
## Test avec encore plus de données :
|
||||
### Commandes :
|
||||
./student_rank 1000 10000 0
|
||||
gprof ./student_rank -b
|
||||
|
||||
La fonction "bubblesort" est la fonction la plus appelée et qui a le plus de temps d'exécution.
|
||||
|
||||
Flat profile:
|
||||
|
||||
Each sample counts as 0.01 seconds.
|
||||
% cumulative self self total
|
||||
time seconds seconds calls s/call s/call name
|
||||
85.02 86.18 86.18 10010000 0.00 0.00 bubblesort
|
||||
14.03 100.41 14.22 10000000 0.00 0.00 find_rank_student
|
||||
0.93 101.35 0.94 1 0.94 101.35 sort_students
|
||||
0.08 101.43 0.09 1000 0.00 0.00 generate_array
|
||||
0.08 101.51 0.08 1 0.08 0.08 generate_ranks
|
||||
0.03 101.54 0.03 print_student_array
|
||||
0.00 101.54 0.00 2 0.00 0.00 free_array
|
||||
0.00 101.54 0.00 1 0.00 0.09 generate_grades
|
||||
|
||||
## Profiling
|
||||
Un appel à la fonction bubblesort était en trop dans la fonction find_rank ce qui augmentait considérablement le temps d'exécution.
|
@ -55,7 +55,7 @@ int find_rank_student(int student_grade, int* grades_array, int students_number)
|
||||
{
|
||||
int position = -1;
|
||||
int i = 0;
|
||||
bubblesort(grades_array,students_number);
|
||||
//bubblesort(grades_array,students_number); <-- Il est en trop :/
|
||||
for(i = students_number-1; i >= 0; i--)
|
||||
{
|
||||
if(grades_array[i] == student_grade)
|
||||
|
Loading…
Reference in New Issue
Block a user