Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b98fe3d632 | |||
| 3a502db974 |
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "linux-gcc-x64",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "${default}",
|
||||
"cppStandard": "${default}",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"compilerArgs": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C/C++ Runner: Debug Session",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": false,
|
||||
"cwd": "/export/home/info-but24/desesque/BUT3/Algo/td1/2026_TD1_DEV51_Qualite_Algo/code",
|
||||
"program": "/export/home/info-but24/desesque/BUT3/Algo/td1/2026_TD1_DEV51_Qualite_Algo/code/build/Debug/outDebug",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"C_Cpp_Runner.cCompilerPath": "gcc",
|
||||
"C_Cpp_Runner.cppCompilerPath": "g++",
|
||||
"C_Cpp_Runner.debuggerPath": "gdb",
|
||||
"C_Cpp_Runner.cStandard": "",
|
||||
"C_Cpp_Runner.cppStandard": "",
|
||||
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
||||
"C_Cpp_Runner.useMsvc": false,
|
||||
"C_Cpp_Runner.warnings": [
|
||||
"-Wall",
|
||||
"-Wextra",
|
||||
"-Wpedantic",
|
||||
"-Wshadow",
|
||||
"-Wformat=2",
|
||||
"-Wcast-align",
|
||||
"-Wconversion",
|
||||
"-Wsign-conversion",
|
||||
"-Wnull-dereference"
|
||||
],
|
||||
"C_Cpp_Runner.msvcWarnings": [
|
||||
"/W4",
|
||||
"/permissive-",
|
||||
"/w14242",
|
||||
"/w14287",
|
||||
"/w14296",
|
||||
"/w14311",
|
||||
"/w14826",
|
||||
"/w44062",
|
||||
"/w44242",
|
||||
"/w14905",
|
||||
"/w14906",
|
||||
"/w14263",
|
||||
"/w44265",
|
||||
"/w14928"
|
||||
],
|
||||
"C_Cpp_Runner.enableWarnings": true,
|
||||
"C_Cpp_Runner.warningsAsError": false,
|
||||
"C_Cpp_Runner.compilerArgs": [],
|
||||
"C_Cpp_Runner.linkerArgs": [],
|
||||
"C_Cpp_Runner.includePaths": [],
|
||||
"C_Cpp_Runner.includeSearch": [
|
||||
"*",
|
||||
"**/*"
|
||||
],
|
||||
"C_Cpp_Runner.excludeSearch": [
|
||||
"**/build",
|
||||
"**/build/**",
|
||||
"**/.*",
|
||||
"**/.*/**",
|
||||
"**/.vscode",
|
||||
"**/.vscode/**"
|
||||
],
|
||||
"C_Cpp_Runner.useAddressSanitizer": false,
|
||||
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
||||
"C_Cpp_Runner.useLeakSanitizer": false,
|
||||
"C_Cpp_Runner.showCompilationTime": false,
|
||||
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
||||
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
||||
}
|
||||
@@ -316,11 +316,11 @@ double longueur_moyenne(const Entree *table, int n)
|
||||
return (double)total / n;
|
||||
}
|
||||
|
||||
double ecart_type_longueur(const Entree *table, int n)
|
||||
double ecart_type_longueur(const Entree *table, int n, double moyenne)
|
||||
{
|
||||
double somme = 0.0;
|
||||
for (int i = 0; i < n; i++) {
|
||||
double ecart = longueur(table[i].mot) - longueur_moyenne(table, n);
|
||||
double ecart = longueur(table[i].mot) - moyenne;
|
||||
somme += ecart * ecart;
|
||||
}
|
||||
return somme / n; /* variance ; la racine est prise dans main */
|
||||
@@ -420,7 +420,7 @@ int main(void)
|
||||
trier_entrees(table, nb_entrees);
|
||||
|
||||
double moyenne = longueur_moyenne(table, nb_entrees);
|
||||
double ecart_type = racine(ecart_type_longueur(table, nb_entrees));
|
||||
double ecart_type = racine(ecart_type_longueur(table, nb_entrees, moyenne));
|
||||
|
||||
char trigramme[4];
|
||||
int occ_trigramme;
|
||||
Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
+275
@@ -0,0 +1,275 @@
|
||||
Flat profile:
|
||||
|
||||
Each sample counts as 0.01 seconds.
|
||||
% cumulative self self total
|
||||
time seconds seconds calls s/call s/call name
|
||||
35.62 0.83 0.83 308734541 0.00 0.00 egales
|
||||
21.03 1.32 0.49 comparer
|
||||
18.03 1.74 0.42 400182 0.00 0.00 compter_mot
|
||||
7.30 1.91 0.17 _init
|
||||
5.79 2.04 0.14 12172087 0.00 0.00 ajouter
|
||||
3.86 2.13 0.09 2 0.04 0.06 analyser_bigrammes
|
||||
3.00 2.21 0.07 en_minuscule
|
||||
2.58 2.27 0.06 1 0.06 1.39 trier_entrees
|
||||
1.07 2.29 0.03 est_lettre
|
||||
0.86 2.31 0.02 36937936 0.00 0.00 copier
|
||||
0.43 2.32 0.01 5867 0.00 0.00 ecart_type_longueur
|
||||
0.43 2.33 0.01 longueur_moyenne
|
||||
0.00 2.33 0.00 6590721 0.00 0.00 generer_vocabulaire
|
||||
0.00 2.33 0.00 171928 0.00 0.00 compter_mots_ligne
|
||||
0.00 2.33 0.00 21746 0.00 0.00 est_mot_vide
|
||||
0.00 2.33 0.00 1 0.00 0.00 construire_rapport
|
||||
0.00 2.33 0.00 1 0.00 0.00 decouper_lignes
|
||||
0.00 2.33 0.00 1 0.00 0.00 generer_texte
|
||||
0.00 2.33 0.00 1 0.00 1.56 main
|
||||
|
||||
% 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.43% of 2.33 seconds
|
||||
|
||||
index % time self children called name
|
||||
1 main [1]
|
||||
0.00 1.56 1/1 _fini [2]
|
||||
[1] 67.1 0.00 1.56 1+1 main [1]
|
||||
0.06 1.33 1/1 trier_entrees [3]
|
||||
0.09 0.03 2/2 analyser_bigrammes [10]
|
||||
0.00 0.06 21746/171928 compter_mots_ligne [7]
|
||||
0.00 0.00 1/1 generer_texte [17]
|
||||
0.00 0.00 1/5867 ecart_type_longueur [14]
|
||||
0.00 0.00 1/6590721 generer_vocabulaire [18]
|
||||
0.00 0.00 21746/21746 est_mot_vide [21]
|
||||
0.00 0.00 1/1 decouper_lignes [23]
|
||||
0.00 0.00 1/1 construire_rapport [22]
|
||||
1 main [1]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[2] 67.1 0.00 1.56 _fini [2]
|
||||
0.00 1.56 1/1 main [1]
|
||||
-----------------------------------------------
|
||||
17202045 trier_entrees [3]
|
||||
0.06 1.33 1/1 main [1]
|
||||
[3] 59.5 0.06 1.33 1+17202045 trier_entrees [3]
|
||||
0.26 0.52 250000/400182 compter_mot [4]
|
||||
0.00 0.41 150182/171928 compter_mots_ligne [7]
|
||||
0.14 0.00 12172087/12172087 ajouter [9]
|
||||
17202045 trier_entrees [3]
|
||||
-----------------------------------------------
|
||||
0.16 0.31 150182/400182 compter_mots_ligne [7]
|
||||
0.26 0.52 250000/400182 trier_entrees [3]
|
||||
[4] 53.6 0.42 0.83 400182 compter_mot [4]
|
||||
0.83 0.00 308701874/308734541 egales [5]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 5866/308734541 compter_mots_ligne [7]
|
||||
0.00 0.00 26801/308734541 generer_vocabulaire [18]
|
||||
0.83 0.00 308701874/308734541 compter_mot [4]
|
||||
[5] 35.6 0.83 0.00 308734541 egales [5]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[6] 21.0 0.49 0.00 comparer [6]
|
||||
-----------------------------------------------
|
||||
0.00 0.06 21746/171928 main [1]
|
||||
0.00 0.41 150182/171928 trier_entrees [3]
|
||||
[7] 20.1 0.00 0.47 171928 compter_mots_ligne [7]
|
||||
0.16 0.31 150182/400182 compter_mot [4]
|
||||
0.00 0.00 5866/308734541 egales [5]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[8] 7.3 0.17 0.00 _init [8]
|
||||
-----------------------------------------------
|
||||
0.14 0.00 12172087/12172087 trier_entrees [3]
|
||||
[9] 5.8 0.14 0.00 12172087 ajouter [9]
|
||||
-----------------------------------------------
|
||||
0.09 0.03 2/2 main [1]
|
||||
[10] 5.1 0.09 0.03 2 analyser_bigrammes [10]
|
||||
0.02 0.00 34421688/36937936 copier [13]
|
||||
0.01 0.00 5866/5867 ecart_type_longueur [14]
|
||||
0.00 0.00 3757672/6590721 generer_vocabulaire [18]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[11] 3.0 0.07 0.00 en_minuscule [11]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[12] 1.1 0.03 0.00 est_lettre [12]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 33801/36937936 generer_vocabulaire [18]
|
||||
0.00 0.00 921117/36937936 generer_texte [17]
|
||||
0.00 0.00 1561330/36937936 chercher_mot [16]
|
||||
0.02 0.00 34421688/36937936 analyser_bigrammes [10]
|
||||
[13] 0.9 0.02 0.00 36937936 copier [13]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 1/5867 main [1]
|
||||
0.01 0.00 5866/5867 analyser_bigrammes [10]
|
||||
[14] 0.4 0.01 0.00 5867 ecart_type_longueur [14]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[15] 0.4 0.01 0.00 longueur_moyenne [15]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[16] 0.0 0.00 0.00 chercher_mot [16]
|
||||
0.00 0.00 1561330/36937936 copier [13]
|
||||
0.00 0.00 2806247/6590721 generer_vocabulaire [18]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 1/1 main [1]
|
||||
[17] 0.0 0.00 0.00 1 generer_texte [17]
|
||||
0.00 0.00 921117/36937936 copier [13]
|
||||
0.00 0.00 20934/6590721 generer_vocabulaire [18]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 1/6590721 empreinte [20]
|
||||
0.00 0.00 1/6590721 main [1]
|
||||
0.00 0.00 5866/6590721 racine [19]
|
||||
0.00 0.00 20934/6590721 generer_texte [17]
|
||||
0.00 0.00 2806247/6590721 chercher_mot [16]
|
||||
0.00 0.00 3757672/6590721 analyser_bigrammes [10]
|
||||
[18] 0.0 0.00 0.00 6590721 generer_vocabulaire [18]
|
||||
0.00 0.00 26801/308734541 egales [5]
|
||||
0.00 0.00 33801/36937936 copier [13]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[19] 0.0 0.00 0.00 racine [19]
|
||||
0.00 0.00 5866/6590721 generer_vocabulaire [18]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[20] 0.0 0.00 0.00 empreinte [20]
|
||||
0.00 0.00 1/6590721 generer_vocabulaire [18]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 21746/21746 main [1]
|
||||
[21] 0.0 0.00 0.00 21746 est_mot_vide [21]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 1/1 main [1]
|
||||
[22] 0.0 0.00 0.00 1 construire_rapport [22]
|
||||
-----------------------------------------------
|
||||
0.00 0.00 1/1 main [1]
|
||||
[23] 0.0 0.00 0.00 1 decouper_lignes [23]
|
||||
-----------------------------------------------
|
||||
|
||||
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
|
||||
|
||||
[8] _init [13] copier [17] generer_texte
|
||||
[9] ajouter [23] decouper_lignes [18] generer_vocabulaire
|
||||
[10] analyser_bigrammes [14] ecart_type_longueur [15] longueur_moyenne
|
||||
[6] comparer [5] egales [1] main
|
||||
[4] compter_mot [11] en_minuscule [3] trier_entrees
|
||||
[7] compter_mots_ligne [12] est_lettre
|
||||
[22] construire_rapport [21] est_mot_vide
|
||||
+5867
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
||||
TD01
|
||||
|
||||
|
||||
1. Mesurer - donner avant
|
||||
|
||||
|
||||
DONNÉES TIME AVANT GPROF :
|
||||
|
||||
|
||||
Empreinte du rapport : 1d53de903efd2b7c
|
||||
|
||||
|
||||
real 0m2.647s
|
||||
user 0m2.624s
|
||||
sys 0m0.000s
|
||||
|
||||
|
||||
|
||||
|
||||
DONNÉES TIME AVEC GPROF :
|
||||
|
||||
|
||||
Empreinte du rapport : 1d53de903efd2b7c
|
||||
|
||||
|
||||
real 0m5.820s
|
||||
user 0m5.773s
|
||||
sys 0m0.007s
|
||||
|
||||
|
||||
2. Analyser
|
||||
Profil plat - temps par fonction
|
||||
On remarque que les fonctions qui prennent le plus de temps et le plus d’appels sont longueur et égales.
|
||||
Pour longueur sur 2.35 secondes cumulées, on est à 0.8 et on a 36009819 appels.
|
||||
Pour egales sur 2.35 secondes cumulées, on est à 1.60 et on a 308701874 appels.
|
||||
C’est notre point de départ.
|
||||
|
||||
|
||||
Graphe d’appel - qui appelle qui et cb de fois
|
||||
Pour réduire le temps total cumulé de secondes pour une fonction donnée, soit on réduit le temps d’un appel, soit le nombre d'appels de la fonction.
|
||||
Donc pour longueur on va regarder le graphe, et on remarque que la fonction qui appelle le plus la fonction c’est longueur_moyenne est c’est sur cette fonction qu’on va essayer de réduire le nombre d'appels de longueur car on ne peut pas réduire le temps d’exécution ici.
|
||||
Donc pour égales on va regarder le graphe, et on remarque que la fonction qui appelle le plus la fonction c’est chercher_mot est c’est sur cette fonction qu’on va essayer de réduire le nombre d'appels de egales car on ne peut pas réduire le temps d’exécution ici.
|
||||
|
||||
|
||||
3. Proposer - pistes d’amélioration
|
||||
1. longueur
|
||||
L’optimisation : Créer une variable dans le main nommée “moyenne”, égale à la valeur de retour de la méthode longueur_moyenne(). Cela permet de simplement lire une valeur de variable plutôt que d’appeler la méthode à mainte reprise.
|
||||
|
||||
|
||||
Empreinte : 1d53de903efd2b7c
|
||||
|
||||
|
||||
2. egales
|
||||
L’optimisation :
|
||||
Empreinte :
|
||||
|
||||
|
||||
|
||||
|
||||
4. Valider
|
||||
DONNÉES TIME AVEC GPROF :
|
||||
|
||||
|
||||
Empreinte du rapport : 1d53de903efd2b7c
|
||||
|
||||
|
||||
real 0m2.111s
|
||||
user 0m2.094s
|
||||
sys 0m0.000s
|
||||
Reference in New Issue
Block a user