14 Commits

Author SHA1 Message Date
SOLAR D d33254d8f6 compte rendu 2026-10-21 12:29:03 +02:00
Kaïs Bens f7edbe1044 profil 2026-10-21 12:28:12 +02:00
Valentin Loison b2b618f5d1 init CompteRendu 2026-10-21 12:07:03 +02:00
SOLAR D e2a8fc7513 F5 2026-10-21 11:43:55 +02:00
Kaïs Bens 2755fca793 F7 2026-10-21 11:43:23 +02:00
SOLAR D e44ffa16ce F6 2026-10-21 11:39:51 +02:00
Kaïs Bens 675605e80f F8 2026-10-21 11:35:22 +02:00
SOLAR D a3b9b4b67e F10 2026-10-21 11:32:21 +02:00
SOLAR D f79eab7eac F9 2026-10-21 11:24:55 +02:00
Valentin Loison d6299b2c28 Merge branch 'main' of https://grond.iut-fbleau.fr/solar/2026_TD3_DEV51_Qualite_Algo 2026-10-21 11:10:42 +02:00
Valentin Loison 914e03b290 fixes F2 2026-10-21 11:08:30 +02:00
SOLAR D ff27c1c013 F1 2026-10-21 11:04:07 +02:00
SOLAR D c54a416069 F4 2026-10-21 10:48:28 +02:00
SOLAR D 5f05c1abfe F3 2026-10-21 10:38:30 +02:00
4 changed files with 689 additions and 100 deletions
+78
View File
@@ -0,0 +1,78 @@
# Dimitri SOLAR / Valentin LOISON / Kais BENS
Empreinte : ff68d260a7a58441
real 2.11s
user 2.11s
sys 0.00s
2. # Profiller
la fonction la plus couteuse est : trier_par_montant pourtant elle n'a pas la complexité la plys élévé .
3.
F1 = O(n^2)
F2 = O(n^2)
F3 = O(n*c)
F4 = O(n*j)
F5 = O(j^2)
F6 = O(n^2)
F7 = O(n^2)
F8 O(2^k)
F9 M=14
F10 = O(n+L)
```console
└─$ ./evaluer.sh banque.c solar
Empreinte correcte
Temps (médiane de 5) : 13 ms
Complexité cyclomatique : vérifiée par l'enseignant
Ligne ajoutée à resultats.csv : solar;-;13
```
4. # Justification
F1 (trier_par_montant)
Remplacement du tri à bulles en O(n^2) par le tri rapide standard qsort en O(n log n).
La fonction de comparaison dédiée traite la clé composite (montant puis identifiant) efficacement.
F2 (nb_clients_distincts)
Remplacement de la double boucle imbriquée en O(n^2)par un tableau de présence (deja_vu).
Le calcul s'effectue désormais en un seul parcours linéaire O(n) grâce à des accès directs en O(1).
F3 (total_par_client)
Suppression de la double boucle en O(clients * n) qui re-parcourait inutilement le tableau pour chaque client.
Accumulation directe des montants sur chaque client au fil d'une passe unique en O(clients + n).
F4 (total_par_jour)
Élimination du parcours complet de toutes les transactions pour chaque jour distinct en O(jours * n).
Parcours unique des transactions avec ajout immédiat au jour correspondant, réduisant le temps à O(jours + n).
F5 (meilleure_periode)
Remplacement du calcul exhaustif de toutes les plages de jours consécutifs en O(n^3).
Application de l'algorithme de Kadane pour trouver la somme maximale en une seule passe linéaire O(n).
F6 (rechercher_par_id)
Remplacement de la recherche linéaire globale répétée en O(n) à la requête.
Mise en place d'une table d'indexation directe (cache statique) offrant un accès immédiat en O(1) par requête.
F7 (nb_paires_opposees)
Passage d'une comparaison de toutes les paires possibles en O(n^2) à un tri préalable des montants en O(n log n).
Utilisation de deux pointeurs convergents pour dénombrer les paires opposées en un parcours linéaire.
F8 (nb_facons_rendre)
Remplacement de l'exploration récursive naïve souffrant d'une complexité temporelle exponentielle.
Adoption de la programmation dynamique via un tableau 1D en O(somme * nb_pieces).
F9 (categorie)
Structuration et modularisation des tests conditionnels via categorie_debit et categorie_credit.
Simplification de l'arbre de décision permettant de réduire les comparaisons et d'aider la prédiction de branchement.
F10 (ajouter_ligne)
Suppression du recalcul de la longueur totale du rapport à chaque insertion, évite un coût global en O(n^2).
Maintien d'un pointeur mobile fin_rapport garantissant une écriture directe à la suite en O(longueur_ligne).
+167 -100
View File
@@ -71,36 +71,34 @@ Transaction *generer_transactions(int n)
/* ------------------------------------------------------------------ */
/* F1 : trie les transactions par montant croissant, puis par id */
static int comparer_transactions(const void *a, const void *b)
{
const Transaction *x = a, *y = b;
if (x->montant != y->montant)
return (x->montant > y->montant) - (x->montant < y->montant);
return (x->id > y->id) - (x->id < y->id);
}
void trier_par_montant(Transaction *t, int n)
{
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - 1 - i; j++) {
if (t[j].montant > t[j + 1].montant ||
(t[j].montant == t[j + 1].montant && t[j].id > t[j + 1].id)) {
Transaction tmp = t[j];
t[j] = t[j + 1];
t[j + 1] = tmp;
}
}
}
qsort(t, n, sizeof *t, comparer_transactions);
}
/* F2 : nombre de clients ayant au moins une transaction */
int nb_clients_distincts(const Transaction *t, int n)
{
int nb = 0;
for (int i = 0; i < n; i++) {
int deja_vu = 0;
for (int j = 0; j < i; j++) {
if (t[j].client == t[i].client) {
deja_vu = 1;
break;
}
}
if (!deja_vu)
nb++;
int nbr_clients = 0;
int *deja_vu = (int*) calloc(NB_CLIENTS,sizeof(int));
for (int i = 0 ; i < n ; i++){
if (deja_vu[t[i].client] == 0){
deja_vu[t[i].client] = 1;
nbr_clients +=1;
}
}
return nb;
free(deja_vu);
return nbr_clients;
}
/* F3 : solde total de chaque client */
@@ -108,20 +106,21 @@ void total_par_client(const Transaction *t, int n, long *totaux)
{
for (int c = 0; c < NB_CLIENTS; c++) {
totaux[c] = 0;
for (int i = 0; i < n; i++)
if (t[i].client == c)
totaux[c] += t[i].montant;
}
for (int i = 0; i < n; i++)
totaux[t[i].client] += t[i].montant;
}
/* F4 : solde total de chaque jour */
void total_par_jour(const Transaction *t, int n, long *totaux)
{
for (int j = 0; j < NB_JOURS; j++) {
for (int j = 0; j < NB_JOURS; j++)
totaux[j] = 0;
for (int i = 0; i < n; i++)
if (t[i].jour == j)
totaux[j] += t[i].montant;
for (int i = 0; i < n; i++) {
int jour = t[i].jour;
if (jour >= 0 && jour < NB_JOURS)
totaux[jour] += t[i].montant;
}
}
@@ -129,18 +128,21 @@ void total_par_jour(const Transaction *t, int n, long *totaux)
long meilleure_periode(const long *totaux, int nb_jours, int *debut, int *fin)
{
long meilleur = totaux[0];
long somme_courante = totaux[0];
int debut_courant = 0;
*debut = 0;
*fin = 0;
for (int i = 0; i < nb_jours; i++) {
for (int j = i; j < nb_jours; j++) {
long somme = 0;
for (int k = i; k <= j; k++)
somme += totaux[k];
if (somme > meilleur) {
meilleur = somme;
*debut = i;
*fin = j;
}
for (int j = 1; j < nb_jours; j++) {
if (somme_courante < 0) {
somme_courante = totaux[j];
debut_courant = j;
} else {
somme_courante += totaux[j];
}
if (somme_courante > meilleur) {
meilleur = somme_courante;
*debut = debut_courant;
*fin = j;
}
}
return meilleur;
@@ -149,6 +151,19 @@ long meilleure_periode(const long *totaux, int nb_jours, int *debut, int *fin)
/* F6 : retrouve une transaction à partir de son id */
const Transaction *rechercher_par_id(const Transaction *t, int n, int id)
{
static const Transaction *index[NB_TRANSACTIONS];
static const Transaction *transactions_indexees;
static int taille_indexee;
if (n <= NB_TRANSACTIONS && (t != transactions_indexees || n != taille_indexee)) {
for (int i = 0; i < n; i++)
index[t[i].id] = &t[i];
transactions_indexees = t;
taille_indexee = n;
}
if (n <= NB_TRANSACTIONS && id >= 0 && id < n && t == transactions_indexees)
return index[id];
for (int i = 0; i < n; i++)
if (t[i].id == id)
return &t[i];
@@ -156,13 +171,56 @@ const Transaction *rechercher_par_id(const Transaction *t, int n, int id)
}
/* F7 : nombre de paires de transactions de montants opposés (a + b = 0) */
static int cmp_long(const void *a, const void *b)
{
long x = *(const long *)a, y = *(const long *)b;
return (x > y) - (x < y);
}
long nb_paires_opposees(const Transaction *t, int n)
{
long nb = 0;
if (n < 2)
return 0;
long *m = malloc(n * sizeof(long));
if (!m)
return 0;
for (int i = 0; i < n; i++)
for (int j = i + 1; j < n; j++)
if (t[i].montant + t[j].montant == 0)
nb++;
m[i] = t[i].montant;
qsort(m, n, sizeof(long), cmp_long); /* O(n log n) */
long nb = 0;
/* zéros : tous les montants nuls forment un bloc contigu */
int deb = 0;
while (deb < n && m[deb] < 0)
deb++;
int fin = deb;
while (fin < n && m[fin] == 0)
fin++;
long z = fin - deb;
nb += z * (z - 1) / 2;
/* deux pointeurs : négatifs depuis la fin de la zone négative,
positifs depuis le début de la zone positive (fin) */
int i = deb - 1; /* plus grand négatif : le plus proche de 0 */
int j = fin; /* plus petit positif : le plus proche de 0 */
while (i >= 0 && j < n) {
long neg = -m[i], pos = m[j];
if (neg < pos) {
i--;
} else if (neg > pos) {
j++;
} else {
long v = pos, a = 0, b = 0;
while (i >= 0 && -m[i] == v) { a++; i--; }
while (j < n && m[j] == v) { b++; j++; }
nb += a * b;
}
}
free(m);
return nb;
}
@@ -172,66 +230,74 @@ static const int PIECES[] = {1, 2, 5, 10, 20, 50, 100, 200};
long nb_facons_rendre(int somme, int nb_pieces)
{
if (somme == 0)
return 1;
if (somme < 0 || nb_pieces == 0)
if (somme < 0)
return 0;
return nb_facons_rendre(somme - PIECES[nb_pieces - 1], nb_pieces) +
nb_facons_rendre(somme, nb_pieces - 1);
if (nb_pieces == 0)
return somme == 0;
long dp[somme + 1];
for (int s = 0; s <= somme; s++)
dp[s] = 1; /* pièce de 1 : une seule façon */
for (int p = 1; p < nb_pieces; p++) {
int c = PIECES[p];
for (int s = c; s <= somme; s++)
dp[s] += dp[s - c];
}
return dp[somme];
}
static int categorie_debit(const Transaction *t)
{
if (t->montant < -20000) {
if (t->jour % 7 == 5 || t->jour % 7 == 6)
return 1;
return 2;
}
if (t->montant < -5000)
return 3;
if (t->client % 10 == 0)
return 4;
return 5;
}
static int categorie_credit(const Transaction *t)
{
if (t->montant > 30000) {
if (t->client % 10 == 0 && t->jour % 7 < 5)
return 6;
return 7;
}
if (t->montant > 10000)
return 8;
if (t->montant > 1000) {
if (t->jour % 30 == 0)
return 9;
return 10;
}
return 11;
}
/* F9 : catégorie d'une transaction (pour les statistiques) */
int categorie(const Transaction *t)
{
if (t->montant < 0) {
if (t->montant < -20000) {
if (t->jour % 7 == 5 || t->jour % 7 == 6)
return 1;
else
return 2;
} else if (t->montant < -5000) {
return 3;
} else {
if (t->client % 10 == 0)
return 4;
return 5;
}
} else if (t->montant == 0) {
if (t->montant < 0)
return categorie_debit(t);
if (t->montant == 0)
return 0;
} else {
if (t->montant > 30000) {
if (t->client % 10 == 0 && t->jour % 7 < 5)
return 6;
return 7;
} else if (t->montant > 10000) {
return 8;
} else if (t->montant > 1000) {
if (t->jour % 30 == 0)
return 9;
return 10;
}
return 11;
}
return categorie_credit(t);
}
/* F10 : ajoute une ligne à la fin du rapport */
int longueur(const char *s)
void ajouter_ligne(char **fin_rapport, const char *ligne)
{
int n = 0;
while (s[n] != '\0')
n++;
return n;
}
void ajouter_ligne(char *rapport, const char *ligne)
{
int fin = longueur(rapport);
int i = 0;
while (ligne[i] != '\0') {
rapport[fin + i] = ligne[i];
i++;
while (*ligne != '\0') {
**fin_rapport = *ligne;
(*fin_rapport)++;
ligne++;
}
rapport[fin + i] = '\0';
**fin_rapport = '\0';
}
/* ------------------------------------------------------------------ */
@@ -252,6 +318,7 @@ int main(void)
{
Transaction *t = generer_transactions(NB_TRANSACTIONS);
char *rapport = malloc(1 << 20);
char *fin_rapport = rapport;
char ligne[128];
rapport[0] = '\0';
@@ -287,30 +354,30 @@ int main(void)
/* rapport */
snprintf(ligne, sizeof(ligne), "clients distincts;%d\n", nb_clients);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
snprintf(ligne, sizeof(ligne), "somme des requetes;%ld\n", somme_requetes);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
snprintf(ligne, sizeof(ligne), "meilleure periode;%d;%d;%ld\n", debut, fin, meilleure);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
snprintf(ligne, sizeof(ligne), "paires opposees;%ld\n", nb_paires);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
snprintf(ligne, sizeof(ligne), "facons de rendre %d;%ld\n", MONTANT_MONNAIE, nb_facons);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
for (int c = 0; c < 12; c++) {
snprintf(ligne, sizeof(ligne), "categorie;%d;%d\n", c, categories[c]);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
}
for (int c = 0; c < NB_CLIENTS; c++) {
snprintf(ligne, sizeof(ligne), "client;%d;%ld\n", c, totaux_clients[c]);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
}
for (int j = 0; j < NB_JOURS; j++) {
snprintf(ligne, sizeof(ligne), "jour;%d;%ld\n", j, totaux_jours[j]);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
}
for (int i = 0; i < NB_TRANSACTIONS; i += 10) {
snprintf(ligne, sizeof(ligne), "rang;%d;%d;%ld\n", i, t[i].id, t[i].montant);
ajouter_ligne(rapport, ligne);
ajouter_ligne(&fin_rapport, ligne);
}
FILE *f = fopen("rapport.txt", "w");
+224
View File
@@ -0,0 +1,224 @@
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls ms/call ms/call name
93.55 0.29 0.29 1 290.00 290.00 meilleure_periode
3.23 0.30 0.01 1 10.00 10.00 nb_paires_opposees
3.23 0.31 0.01 comparer_transactions
0.00 0.31 0.00 149998 0.00 0.00 alea
0.00 0.31 0.00 30000 0.00 0.00 categorie
0.00 0.31 0.00 30000 0.00 0.00 rechercher_par_id
0.00 0.31 0.00 15066 0.00 0.00 categorie_debit
0.00 0.31 0.00 14934 0.00 0.00 categorie_credit
0.00 0.31 0.00 6017 0.00 0.00 ajouter_ligne
0.00 0.31 0.00 1 0.00 0.00 empreinte
0.00 0.31 0.00 1 0.00 0.00 generer_transactions
0.00 0.31 0.00 1 0.00 0.00 nb_clients_distincts
0.00 0.31 0.00 1 0.00 0.00 nb_facons_rendre
0.00 0.31 0.00 1 0.00 0.00 total_par_client
0.00 0.31 0.00 1 0.00 0.00 total_par_jour
0.00 0.31 0.00 1 0.00 0.00 trier_par_montant
% 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 3.23% of 0.31 seconds
index % time self children called name
<spontaneous>
[1] 96.8 0.00 0.30 main [1]
0.29 0.00 1/1 meilleure_periode [2]
0.01 0.00 1/1 nb_paires_opposees [3]
0.00 0.00 30000/30000 rechercher_par_id [7]
0.00 0.00 30000/30000 categorie [6]
0.00 0.00 6017/6017 ajouter_ligne [10]
0.00 0.00 1/1 generer_transactions [12]
0.00 0.00 1/1 nb_clients_distincts [13]
0.00 0.00 1/1 total_par_client [15]
0.00 0.00 1/1 total_par_jour [16]
0.00 0.00 1/1 trier_par_montant [17]
0.00 0.00 1/1 nb_facons_rendre [14]
0.00 0.00 1/1 empreinte [11]
-----------------------------------------------
0.29 0.00 1/1 main [1]
[2] 93.5 0.29 0.00 1 meilleure_periode [2]
-----------------------------------------------
0.01 0.00 1/1 main [1]
[3] 3.2 0.01 0.00 1 nb_paires_opposees [3]
-----------------------------------------------
<spontaneous>
[4] 3.2 0.01 0.00 comparer_transactions [4]
-----------------------------------------------
0.00 0.00 149998/149998 generer_transactions [12]
[5] 0.0 0.00 0.00 149998 alea [5]
-----------------------------------------------
0.00 0.00 30000/30000 main [1]
[6] 0.0 0.00 0.00 30000 categorie [6]
0.00 0.00 15066/15066 categorie_debit [8]
0.00 0.00 14934/14934 categorie_credit [9]
-----------------------------------------------
0.00 0.00 30000/30000 main [1]
[7] 0.0 0.00 0.00 30000 rechercher_par_id [7]
-----------------------------------------------
0.00 0.00 15066/15066 categorie [6]
[8] 0.0 0.00 0.00 15066 categorie_debit [8]
-----------------------------------------------
0.00 0.00 14934/14934 categorie [6]
[9] 0.0 0.00 0.00 14934 categorie_credit [9]
-----------------------------------------------
0.00 0.00 6017/6017 main [1]
[10] 0.0 0.00 0.00 6017 ajouter_ligne [10]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[11] 0.0 0.00 0.00 1 empreinte [11]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[12] 0.0 0.00 0.00 1 generer_transactions [12]
0.00 0.00 149998/149998 alea [5]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[13] 0.0 0.00 0.00 1 nb_clients_distincts [13]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[14] 0.0 0.00 0.00 1 nb_facons_rendre [14]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[15] 0.0 0.00 0.00 1 total_par_client [15]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[16] 0.0 0.00 0.00 1 total_par_jour [16]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[17] 0.0 0.00 0.00 1 trier_par_montant [17]
-----------------------------------------------
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
[10] ajouter_ligne [11] empreinte [7] rechercher_par_id
[5] alea [12] generer_transactions [15] total_par_client
[6] categorie [2] meilleure_periode [16] total_par_jour
[9] categorie_credit (banque.c) [13] nb_clients_distincts [17] trier_par_montant
[8] categorie_debit (banque.c) [14] nb_facons_rendre
[4] comparer_transactions (banque.c) [3] nb_paires_opposees
+220
View File
@@ -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
50.25 3.05 3.05 1 3.05 3.05 trier_par_montant
13.18 3.85 0.80 30000 0.00 0.00 rechercher_par_id
12.52 4.61 0.76 1 0.76 0.76 nb_paires_opposees
9.06 5.16 0.55 1 0.55 0.55 nb_facons_rendre
6.59 5.56 0.40 6017 0.00 0.00 longueur
5.11 5.87 0.31 1 0.31 0.31 meilleure_periode
1.65 5.97 0.10 1 0.10 0.10 nb_clients_distincts
0.99 6.03 0.06 1 0.06 0.06 total_par_jour
0.66 6.07 0.04 _init
0.00 6.07 0.00 149998 0.00 0.00 alea
0.00 6.07 0.00 30000 0.00 0.00 categorie
0.00 6.07 0.00 6017 0.00 0.00 ajouter_ligne
0.00 6.07 0.00 1 0.00 0.00 empreinte
0.00 6.07 0.00 1 0.00 0.00 generer_transactions
0.00 6.07 0.00 1 0.00 0.00 total_par_client
% 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.16% of 6.07 seconds
index % time self children called name
<spontaneous>
[1] 99.3 0.00 6.03 main [1]
3.05 0.00 1/1 trier_par_montant [2]
0.80 0.00 30000/30000 rechercher_par_id [3]
0.76 0.00 1/1 nb_paires_opposees [4]
0.55 0.00 1/1 nb_facons_rendre [5]
0.00 0.40 6017/6017 ajouter_ligne [6]
0.31 0.00 1/1 meilleure_periode [8]
0.10 0.00 1/1 nb_clients_distincts [9]
0.06 0.00 1/1 total_par_jour [10]
0.00 0.00 30000/30000 categorie [13]
0.00 0.00 1/1 generer_transactions [15]
0.00 0.00 1/1 total_par_client [16]
0.00 0.00 1/1 empreinte [14]
-----------------------------------------------
3.05 0.00 1/1 main [1]
[2] 50.2 3.05 0.00 1 trier_par_montant [2]
-----------------------------------------------
0.80 0.00 30000/30000 main [1]
[3] 13.2 0.80 0.00 30000 rechercher_par_id [3]
-----------------------------------------------
0.76 0.00 1/1 main [1]
[4] 12.5 0.76 0.00 1 nb_paires_opposees [4]
-----------------------------------------------
266723738 nb_facons_rendre [5]
0.55 0.00 1/1 main [1]
[5] 9.1 0.55 0.00 1+266723738 nb_facons_rendre [5]
266723738 nb_facons_rendre [5]
-----------------------------------------------
0.00 0.40 6017/6017 main [1]
[6] 6.6 0.00 0.40 6017 ajouter_ligne [6]
0.40 0.00 6017/6017 longueur [7]
-----------------------------------------------
0.40 0.00 6017/6017 ajouter_ligne [6]
[7] 6.6 0.40 0.00 6017 longueur [7]
-----------------------------------------------
0.31 0.00 1/1 main [1]
[8] 5.1 0.31 0.00 1 meilleure_periode [8]
-----------------------------------------------
0.10 0.00 1/1 main [1]
[9] 1.6 0.10 0.00 1 nb_clients_distincts [9]
-----------------------------------------------
0.06 0.00 1/1 main [1]
[10] 1.0 0.06 0.00 1 total_par_jour [10]
-----------------------------------------------
<spontaneous>
[11] 0.7 0.04 0.00 _init [11]
-----------------------------------------------
0.00 0.00 149998/149998 generer_transactions [15]
[12] 0.0 0.00 0.00 149998 alea [12]
-----------------------------------------------
0.00 0.00 30000/30000 main [1]
[13] 0.0 0.00 0.00 30000 categorie [13]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[14] 0.0 0.00 0.00 1 empreinte [14]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[15] 0.0 0.00 0.00 1 generer_transactions [15]
0.00 0.00 149998/149998 alea [12]
-----------------------------------------------
0.00 0.00 1/1 main [1]
[16] 0.0 0.00 0.00 1 total_par_client [16]
-----------------------------------------------
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 [15] generer_transactions [4] nb_paires_opposees
[6] ajouter_ligne [7] longueur [3] rechercher_par_id
[12] alea [8] meilleure_periode [16] total_par_client
[13] categorie [9] nb_clients_distincts [10] total_par_jour
[14] empreinte [5] nb_facons_rendre [2] trier_par_montant