forked from menault/2026_TD3_DEV51_Qualite_Algo
Compare commits
9 Commits
d6299b2c28
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d33254d8f6 | |||
| f7edbe1044 | |||
| b2b618f5d1 | |||
| e2a8fc7513 | |||
| 2755fca793 | |||
| e44ffa16ce | |||
| 675605e80f | |||
| a3b9b4b67e | |||
| f79eab7eac |
@@ -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).
|
||||||
@@ -128,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 meilleure_periode(const long *totaux, int nb_jours, int *debut, int *fin)
|
||||||
{
|
{
|
||||||
long meilleur = totaux[0];
|
long meilleur = totaux[0];
|
||||||
|
long somme_courante = totaux[0];
|
||||||
|
int debut_courant = 0;
|
||||||
*debut = 0;
|
*debut = 0;
|
||||||
*fin = 0;
|
*fin = 0;
|
||||||
for (int i = 0; i < nb_jours; i++) {
|
for (int j = 1; j < nb_jours; j++) {
|
||||||
for (int j = i; j < nb_jours; j++) {
|
if (somme_courante < 0) {
|
||||||
long somme = 0;
|
somme_courante = totaux[j];
|
||||||
for (int k = i; k <= j; k++)
|
debut_courant = j;
|
||||||
somme += totaux[k];
|
} else {
|
||||||
if (somme > meilleur) {
|
somme_courante += totaux[j];
|
||||||
meilleur = somme;
|
|
||||||
*debut = i;
|
|
||||||
*fin = j;
|
|
||||||
}
|
}
|
||||||
|
if (somme_courante > meilleur) {
|
||||||
|
meilleur = somme_courante;
|
||||||
|
*debut = debut_courant;
|
||||||
|
*fin = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return meilleur;
|
return meilleur;
|
||||||
@@ -148,6 +151,19 @@ long meilleure_periode(const long *totaux, int nb_jours, int *debut, int *fin)
|
|||||||
/* F6 : retrouve une transaction à partir de son id */
|
/* F6 : retrouve une transaction à partir de son id */
|
||||||
const Transaction *rechercher_par_id(const Transaction *t, int n, int 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++)
|
for (int i = 0; i < n; i++)
|
||||||
if (t[i].id == id)
|
if (t[i].id == id)
|
||||||
return &t[i];
|
return &t[i];
|
||||||
@@ -155,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) */
|
/* 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_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 i = 0; i < n; i++)
|
||||||
for (int j = i + 1; j < n; j++)
|
m[i] = t[i].montant;
|
||||||
if (t[i].montant + t[j].montant == 0)
|
|
||||||
nb++;
|
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;
|
return nb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -171,66 +230,74 @@ static const int PIECES[] = {1, 2, 5, 10, 20, 50, 100, 200};
|
|||||||
|
|
||||||
long nb_facons_rendre(int somme, int nb_pieces)
|
long nb_facons_rendre(int somme, int nb_pieces)
|
||||||
{
|
{
|
||||||
if (somme == 0)
|
if (somme < 0)
|
||||||
return 1;
|
|
||||||
if (somme < 0 || nb_pieces == 0)
|
|
||||||
return 0;
|
return 0;
|
||||||
return nb_facons_rendre(somme - PIECES[nb_pieces - 1], nb_pieces) +
|
if (nb_pieces == 0)
|
||||||
nb_facons_rendre(somme, nb_pieces - 1);
|
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];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* F9 : catégorie d'une transaction (pour les statistiques) */
|
static int categorie_debit(const Transaction *t)
|
||||||
int categorie(const Transaction *t)
|
|
||||||
{
|
{
|
||||||
if (t->montant < 0) {
|
|
||||||
if (t->montant < -20000) {
|
if (t->montant < -20000) {
|
||||||
if (t->jour % 7 == 5 || t->jour % 7 == 6)
|
if (t->jour % 7 == 5 || t->jour % 7 == 6)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
|
||||||
return 2;
|
return 2;
|
||||||
} else if (t->montant < -5000) {
|
}
|
||||||
|
if (t->montant < -5000)
|
||||||
return 3;
|
return 3;
|
||||||
} else {
|
|
||||||
if (t->client % 10 == 0)
|
if (t->client % 10 == 0)
|
||||||
return 4;
|
return 4;
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
} else if (t->montant == 0) {
|
|
||||||
return 0;
|
static int categorie_credit(const Transaction *t)
|
||||||
} else {
|
{
|
||||||
if (t->montant > 30000) {
|
if (t->montant > 30000) {
|
||||||
if (t->client % 10 == 0 && t->jour % 7 < 5)
|
if (t->client % 10 == 0 && t->jour % 7 < 5)
|
||||||
return 6;
|
return 6;
|
||||||
return 7;
|
return 7;
|
||||||
} else if (t->montant > 10000) {
|
}
|
||||||
|
if (t->montant > 10000)
|
||||||
return 8;
|
return 8;
|
||||||
} else if (t->montant > 1000) {
|
if (t->montant > 1000) {
|
||||||
if (t->jour % 30 == 0)
|
if (t->jour % 30 == 0)
|
||||||
return 9;
|
return 9;
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
return 11;
|
return 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* F9 : catégorie d'une transaction (pour les statistiques) */
|
||||||
|
int categorie(const Transaction *t)
|
||||||
|
{
|
||||||
|
if (t->montant < 0)
|
||||||
|
return categorie_debit(t);
|
||||||
|
if (t->montant == 0)
|
||||||
|
return 0;
|
||||||
|
return categorie_credit(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* F10 : ajoute une ligne à la fin du rapport */
|
/* 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 (*ligne != '\0') {
|
||||||
while (s[n] != '\0')
|
**fin_rapport = *ligne;
|
||||||
n++;
|
(*fin_rapport)++;
|
||||||
return n;
|
ligne++;
|
||||||
}
|
}
|
||||||
|
**fin_rapport = '\0';
|
||||||
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++;
|
|
||||||
}
|
|
||||||
rapport[fin + i] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
/* ------------------------------------------------------------------ */
|
||||||
@@ -251,6 +318,7 @@ int main(void)
|
|||||||
{
|
{
|
||||||
Transaction *t = generer_transactions(NB_TRANSACTIONS);
|
Transaction *t = generer_transactions(NB_TRANSACTIONS);
|
||||||
char *rapport = malloc(1 << 20);
|
char *rapport = malloc(1 << 20);
|
||||||
|
char *fin_rapport = rapport;
|
||||||
char ligne[128];
|
char ligne[128];
|
||||||
rapport[0] = '\0';
|
rapport[0] = '\0';
|
||||||
|
|
||||||
@@ -286,30 +354,30 @@ int main(void)
|
|||||||
|
|
||||||
/* rapport */
|
/* rapport */
|
||||||
snprintf(ligne, sizeof(ligne), "clients distincts;%d\n", nb_clients);
|
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);
|
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);
|
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);
|
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);
|
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++) {
|
for (int c = 0; c < 12; c++) {
|
||||||
snprintf(ligne, sizeof(ligne), "categorie;%d;%d\n", c, categories[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++) {
|
for (int c = 0; c < NB_CLIENTS; c++) {
|
||||||
snprintf(ligne, sizeof(ligne), "client;%d;%ld\n", c, totaux_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++) {
|
for (int j = 0; j < NB_JOURS; j++) {
|
||||||
snprintf(ligne, sizeof(ligne), "jour;%d;%ld\n", j, totaux_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) {
|
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);
|
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");
|
FILE *f = fopen("rapport.txt", "w");
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user