forked from menault/2026_TD3_DEV51_Qualite_Algo
Palier 1 : objectifs
This commit is contained in:
@@ -0,0 +1,86 @@
|
|||||||
|
# Groupe :
|
||||||
|
- Karl FRAMERY
|
||||||
|
- Ozvann ABRAHAM
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 1.Mesurer
|
||||||
|
|
||||||
|
```gcc -O2 banque.c -o banque && time ./banque```
|
||||||
|
|
||||||
|
```
|
||||||
|
Empreinte : ff68d260a7a58441
|
||||||
|
|
||||||
|
real 0m4,793s
|
||||||
|
user 0m4,772s
|
||||||
|
sys 0m0,005s
|
||||||
|
```
|
||||||
|
|
||||||
|
Le temps d'éxecution du programme est de 4.793 seconde et l'emprunte est <ff68d260a7a58441>
|
||||||
|
|
||||||
|
|
||||||
|
# 2.Profiler
|
||||||
|
|
||||||
|
|
||||||
|
La fonction F1 : <trier_par_montant> est d'une complexité <span style="color:yellow">[O(n²)]</span> pour une utilisation du temps de 43.77% du temps totale d'exécution pour 1 call.
|
||||||
|
|
||||||
|
La fonction F7 : <nb_paires_opposees> est d'une complexité <span style="color:yellow">[O(n²)]</span> pour une utilisation du temps de 15.32% du temps totale d'exécution pour 1 call.
|
||||||
|
|
||||||
|
La fonction F8 : <nb_facons_rendre> est d'une complexité <span style="color:red">[O(2^n)]</span> pour une utilisation du temps de 12.84% du temps totale d'exécution pour 1 call.
|
||||||
|
|
||||||
|
La fonction F6 : <rechercher_par_id> est d'une complexité <span style="color:blue">[O(n)]</span> pour une utilisation du temps de 12.21% du temps totale d'exécution pour 30000 calls.
|
||||||
|
|
||||||
|
|
||||||
|
On peut voir que les fonctions les plus coûteuse ont les plus grande complexité.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 3.Calculer
|
||||||
|
|
||||||
|
|
||||||
|
### Fonction F1
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:yellow">[O(n²)]</span> pour un M de 6
|
||||||
|
|
||||||
|
### Fonction F2
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:yellow">[O(n²)]</span> pour un M de 5
|
||||||
|
|
||||||
|
### Fonction F3
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:yellow">[O(n²)]</span> pour un M de 4
|
||||||
|
|
||||||
|
### Fonction F4
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:yellow">[O(n²)]</span> pour un M de 4
|
||||||
|
|
||||||
|
### Fonction F5
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:yellow">[O(n³)]</span> pour un M de 5
|
||||||
|
|
||||||
|
### Fonction F6
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:blue">[O(n)]</span> pour un M de 3
|
||||||
|
|
||||||
|
### Fonction F7
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:yellow">[O(n²)]</span> pour un M de 4
|
||||||
|
|
||||||
|
### Fonction F8
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:red">[O(2^n)]</span> pour un M de 4
|
||||||
|
|
||||||
|
### Fonction F9
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:blue">[O(1)]</span> pour un M de 14
|
||||||
|
|
||||||
|
### Fonction F10
|
||||||
|
|
||||||
|
La complexité de la fonction est de <span style="color:blue">[O(n)]</span> pour un M de 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
Flat profile:
|
||||||
|
|
||||||
|
Each sample counts as 0.01 seconds.
|
||||||
|
% cumulative self self total
|
||||||
|
time seconds seconds calls s/call s/call name
|
||||||
|
43.77 5.20 5.20 1 5.20 5.20 trier_par_montant
|
||||||
|
15.32 7.02 1.82 1 1.82 1.82 nb_paires_opposees
|
||||||
|
12.84 8.54 1.52 1 1.52 1.52 nb_facons_rendre
|
||||||
|
12.21 9.99 1.45 30000 0.00 0.00 rechercher_par_id
|
||||||
|
6.06 10.71 0.72 6017 0.00 0.00 longueur
|
||||||
|
4.04 11.20 0.48 1 0.48 0.48 meilleure_periode
|
||||||
|
1.94 11.43 0.23 1 0.23 0.23 nb_clients_distincts
|
||||||
|
1.60 11.62 0.19 1 0.19 0.19 total_par_client
|
||||||
|
1.01 11.73 0.12 _init
|
||||||
|
0.84 11.84 0.10 1 0.10 0.10 total_par_jour
|
||||||
|
0.38 11.88 0.04 30000 0.00 0.00 categorie
|
||||||
|
0.00 11.88 0.00 149998 0.00 0.00 alea
|
||||||
|
0.00 11.88 0.00 6017 0.00 0.00 ajouter_ligne
|
||||||
|
0.00 11.88 0.00 1 0.00 0.00 empreinte
|
||||||
|
0.00 11.88 0.00 1 0.00 0.00 generer_transactions
|
||||||
|
|
||||||
|
% the percentage of the total running time of the
|
||||||
|
time program used by this function.
|
||||||
|
|
||||||
|
cumulative a running sum of the number of seconds accounted
|
||||||
|
seconds for by this function and those listed above it.
|
||||||
|
|
||||||
|
self the number of seconds accounted for by this
|
||||||
|
seconds function alone. This is the major sort for this
|
||||||
|
listing.
|
||||||
|
|
||||||
|
calls the number of times this function was invoked, if
|
||||||
|
this function is profiled, else blank.
|
||||||
|
|
||||||
|
self the average number of milliseconds spent in this
|
||||||
|
ms/call function per call, if this function is profiled,
|
||||||
|
else blank.
|
||||||
|
|
||||||
|
total the average number of milliseconds spent in this
|
||||||
|
ms/call function and its descendents per call, if this
|
||||||
|
function is profiled, else blank.
|
||||||
|
|
||||||
|
name the name of the function. This is the minor sort
|
||||||
|
for this listing. The index shows the location of
|
||||||
|
the function in the gprof listing. If the index is
|
||||||
|
in parenthesis it shows where it would appear in
|
||||||
|
the gprof listing if it were to be printed.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2026 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Copying and distribution of this file, with or without modification,
|
||||||
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
notice and this notice are preserved.
|
||||||
|
|
||||||
|
Call graph (explanation follows)
|
||||||
|
|
||||||
|
|
||||||
|
granularity: each sample hit covers 4 byte(s) for 0.08% of 11.88 seconds
|
||||||
|
|
||||||
|
index % time self children called name
|
||||||
|
<spontaneous>
|
||||||
|
[1] 99.0 0.00 11.76 main [1]
|
||||||
|
5.20 0.00 1/1 trier_par_montant [2]
|
||||||
|
1.82 0.00 1/1 nb_paires_opposees [3]
|
||||||
|
1.52 0.00 1/1 nb_facons_rendre [4]
|
||||||
|
1.45 0.00 30000/30000 rechercher_par_id [5]
|
||||||
|
0.00 0.72 6017/6017 ajouter_ligne [6]
|
||||||
|
0.48 0.00 1/1 meilleure_periode [8]
|
||||||
|
0.23 0.00 1/1 nb_clients_distincts [9]
|
||||||
|
0.19 0.00 1/1 total_par_client [10]
|
||||||
|
0.10 0.00 1/1 total_par_jour [12]
|
||||||
|
0.04 0.00 30000/30000 categorie [13]
|
||||||
|
0.00 0.00 1/1 generer_transactions [16]
|
||||||
|
0.00 0.00 1/1 empreinte [15]
|
||||||
|
-----------------------------------------------
|
||||||
|
5.20 0.00 1/1 main [1]
|
||||||
|
[2] 43.8 5.20 0.00 1 trier_par_montant [2]
|
||||||
|
-----------------------------------------------
|
||||||
|
1.82 0.00 1/1 main [1]
|
||||||
|
[3] 15.3 1.82 0.00 1 nb_paires_opposees [3]
|
||||||
|
-----------------------------------------------
|
||||||
|
266723738 nb_facons_rendre [4]
|
||||||
|
1.52 0.00 1/1 main [1]
|
||||||
|
[4] 12.8 1.52 0.00 1+266723738 nb_facons_rendre [4]
|
||||||
|
266723738 nb_facons_rendre [4]
|
||||||
|
-----------------------------------------------
|
||||||
|
1.45 0.00 30000/30000 main [1]
|
||||||
|
[5] 12.2 1.45 0.00 30000 rechercher_par_id [5]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.00 0.72 6017/6017 main [1]
|
||||||
|
[6] 6.1 0.00 0.72 6017 ajouter_ligne [6]
|
||||||
|
0.72 0.00 6017/6017 longueur [7]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.72 0.00 6017/6017 ajouter_ligne [6]
|
||||||
|
[7] 6.1 0.72 0.00 6017 longueur [7]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.48 0.00 1/1 main [1]
|
||||||
|
[8] 4.0 0.48 0.00 1 meilleure_periode [8]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.23 0.00 1/1 main [1]
|
||||||
|
[9] 1.9 0.23 0.00 1 nb_clients_distincts [9]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.19 0.00 1/1 main [1]
|
||||||
|
[10] 1.6 0.19 0.00 1 total_par_client [10]
|
||||||
|
-----------------------------------------------
|
||||||
|
<spontaneous>
|
||||||
|
[11] 1.0 0.12 0.00 _init [11]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.10 0.00 1/1 main [1]
|
||||||
|
[12] 0.8 0.10 0.00 1 total_par_jour [12]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.04 0.00 30000/30000 main [1]
|
||||||
|
[13] 0.4 0.04 0.00 30000 categorie [13]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.00 0.00 149998/149998 generer_transactions [16]
|
||||||
|
[14] 0.0 0.00 0.00 149998 alea [14]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.00 0.00 1/1 main [1]
|
||||||
|
[15] 0.0 0.00 0.00 1 empreinte [15]
|
||||||
|
-----------------------------------------------
|
||||||
|
0.00 0.00 1/1 main [1]
|
||||||
|
[16] 0.0 0.00 0.00 1 generer_transactions [16]
|
||||||
|
0.00 0.00 149998/149998 alea [14]
|
||||||
|
-----------------------------------------------
|
||||||
|
|
||||||
|
This table describes the call tree of the program, and was sorted by
|
||||||
|
the total amount of time spent in each function and its children.
|
||||||
|
|
||||||
|
Each entry in this table consists of several lines. The line with the
|
||||||
|
index number at the left hand margin lists the current function.
|
||||||
|
The lines above it list the functions that called this function,
|
||||||
|
and the lines below it list the functions this one called.
|
||||||
|
This line lists:
|
||||||
|
index A unique number given to each element of the table.
|
||||||
|
Index numbers are sorted numerically.
|
||||||
|
The index number is printed next to every function name so
|
||||||
|
it is easier to look up where the function is in the table.
|
||||||
|
|
||||||
|
% time This is the percentage of the `total' time that was spent
|
||||||
|
in this function and its children. Note that due to
|
||||||
|
different viewpoints, functions excluded by options, etc,
|
||||||
|
these numbers will NOT add up to 100%.
|
||||||
|
|
||||||
|
self This is the total amount of time spent in this function.
|
||||||
|
|
||||||
|
children This is the total amount of time propagated into this
|
||||||
|
function by its children.
|
||||||
|
|
||||||
|
called This is the number of times the function was called.
|
||||||
|
If the function called itself recursively, the number
|
||||||
|
only includes non-recursive calls, and is followed by
|
||||||
|
a `+' and the number of recursive calls.
|
||||||
|
|
||||||
|
name The name of the current function. The index number is
|
||||||
|
printed after it. If the function is a member of a
|
||||||
|
cycle, the cycle number is printed between the
|
||||||
|
function's name and the index number.
|
||||||
|
|
||||||
|
|
||||||
|
For the function's parents, the fields have the following meanings:
|
||||||
|
|
||||||
|
self This is the amount of time that was propagated directly
|
||||||
|
from the function into this parent.
|
||||||
|
|
||||||
|
children This is the amount of time that was propagated from
|
||||||
|
the function's children into this parent.
|
||||||
|
|
||||||
|
called This is the number of times this parent called the
|
||||||
|
function `/' the total number of times the function
|
||||||
|
was called. Recursive calls to the function are not
|
||||||
|
included in the number after the `/'.
|
||||||
|
|
||||||
|
name This is the name of the parent. The parent's index
|
||||||
|
number is printed after it. If the parent is a
|
||||||
|
member of a cycle, the cycle number is printed between
|
||||||
|
the name and the index number.
|
||||||
|
|
||||||
|
If the parents of the function cannot be determined, the word
|
||||||
|
`<spontaneous>' is printed in the `name' field, and all the other
|
||||||
|
fields are blank.
|
||||||
|
|
||||||
|
For the function's children, the fields have the following meanings:
|
||||||
|
|
||||||
|
self This is the amount of time that was propagated directly
|
||||||
|
from the child into the function.
|
||||||
|
|
||||||
|
children This is the amount of time that was propagated from the
|
||||||
|
child's children to the function.
|
||||||
|
|
||||||
|
called This is the number of times the function called
|
||||||
|
this child `/' the total number of times the child
|
||||||
|
was called. Recursive calls by the child are not
|
||||||
|
listed in the number after the `/'.
|
||||||
|
|
||||||
|
name This is the name of the child. The child's index
|
||||||
|
number is printed after it. If the child is a
|
||||||
|
member of a cycle, the cycle number is printed
|
||||||
|
between the name and the index number.
|
||||||
|
|
||||||
|
If there are any cycles (circles) in the call graph, there is an
|
||||||
|
entry for the cycle-as-a-whole. This entry shows who called the
|
||||||
|
cycle (as parents) and the members of the cycle (as children.)
|
||||||
|
The `+' recursive calls entry shows the number of function calls that
|
||||||
|
were internal to the cycle, and the calls entry for each member shows,
|
||||||
|
for that member, how many times it was called from other members of
|
||||||
|
the cycle.
|
||||||
|
|
||||||
|
Copyright (C) 2012-2026 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
Copying and distribution of this file, with or without modification,
|
||||||
|
are permitted in any medium without royalty provided the copyright
|
||||||
|
notice and this notice are preserved.
|
||||||
|
|
||||||
|
Index by function name
|
||||||
|
|
||||||
|
[11] _init [16] generer_transactions [3] nb_paires_opposees
|
||||||
|
[6] ajouter_ligne [7] longueur [5] rechercher_par_id
|
||||||
|
[14] alea [8] meilleure_periode [10] total_par_client
|
||||||
|
[13] categorie [9] nb_clients_distincts [12] total_par_jour
|
||||||
|
[15] empreinte [4] nb_facons_rendre [2] trier_par_montant
|
||||||
+6017
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user