Compare commits
8 Commits
main
..
82a77ec17c
| Author | SHA1 | Date | |
|---|---|---|---|
| 82a77ec17c | |||
| bf16afd727 | |||
| 96abb3e2d0 | |||
| 97155f2688 | |||
| 1e3ac9d8d2 | |||
| a5e748e993 | |||
| df4e8876fb | |||
| 1f17823a2c |
+108
@@ -0,0 +1,108 @@
|
||||
# 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
|
||||
|
||||
|
||||
|
||||
# 4. Optimisation
|
||||
|
||||
- Optimisation de la fonction 1 nom du commit : ""
|
||||
|
||||
- Optimisation de la fonction 2 nom du commit : "fonction 2 : O(n + C)". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 3 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 4 nom du commit : "fonction 4 : O(n + J)". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 5 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 6 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 7 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 8 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 9 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
- Optimisation de la fonction 10 nom du commit : "". Emprunte : ff68d260a7a58441
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,337 @@
|
||||
<<<<<<< HEAD
|
||||
/*
|
||||
* R5.A.04 - Qualité Algorithmique
|
||||
* TD Complexité algorithmique : analyse des transactions d'une banque
|
||||
*
|
||||
* Le programme génère des transactions pseudo-aléatoires (toujours les
|
||||
* mêmes, grâce à une graine fixe), puis calcule plusieurs indicateurs
|
||||
* et produit un rapport dans rapport.txt.
|
||||
*
|
||||
* L'empreinte affichée à la fin doit rester IDENTIQUE après vos
|
||||
* optimisations : elle prouve que le résultat n'a pas changé.
|
||||
*
|
||||
* Interdit : modifier les constantes, la génération des données,
|
||||
* le format du rapport, ou écrire les résultats « en dur ».
|
||||
*
|
||||
* Compilation : gcc -O2 banque.c -o banque
|
||||
* Profiling : gcc -O0 -g -pg banque.c -o banque && ./banque && gprof ./banque gmon.out
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define NB_TRANSACTIONS 30000
|
||||
#define NB_CLIENTS 2000
|
||||
#define NB_JOURS 1000
|
||||
#define NB_REQUETES 30000
|
||||
#define MONTANT_MONNAIE 400
|
||||
#define GRAINE 20261020UL
|
||||
|
||||
typedef struct {
|
||||
int id;
|
||||
int client;
|
||||
int jour;
|
||||
long montant; /* en centimes, négatif pour un débit */
|
||||
} Transaction;
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Données (ne pas modifier) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
static unsigned long etat_alea = GRAINE;
|
||||
|
||||
unsigned long alea(void)
|
||||
{
|
||||
etat_alea = etat_alea * 6364136223846793005UL + 1442695040888963407UL;
|
||||
return etat_alea >> 33;
|
||||
}
|
||||
|
||||
Transaction *generer_transactions(int n)
|
||||
{
|
||||
Transaction *t = malloc(n * sizeof(Transaction));
|
||||
for (int i = 0; i < n; i++) {
|
||||
t[i].id = i;
|
||||
t[i].client = alea() % NB_CLIENTS;
|
||||
t[i].jour = alea() % NB_JOURS;
|
||||
if (i > 0 && alea() % 20 == 0)
|
||||
t[i].montant = -t[alea() % i].montant; /* opération inverse */
|
||||
else
|
||||
t[i].montant = (long)(alea() % 100001) - 50000;
|
||||
}
|
||||
for (int i = n - 1; i > 0; i--) { /* mélange des id */
|
||||
int j = alea() % (i + 1);
|
||||
int tmp = t[i].id;
|
||||
t[i].id = t[j].id;
|
||||
t[j].id = tmp;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Fonctions à analyser et à optimiser */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* F1 : trie les transactions par montant croissant, puis par id */
|
||||
void trier_par_montant(Transaction *t, int n)
|
||||
{
|
||||
for (int i = 1; i < n; i++) {
|
||||
Transaction cle = t[i];
|
||||
int j = i - 1;
|
||||
while (j >= 0 && (t[j].montant > cle.montant ||
|
||||
(t[j].montant == cle.montant && t[j].id > cle.id))) {
|
||||
t[j + 1] = t[j];
|
||||
j--;
|
||||
}
|
||||
t[j + 1] = cle;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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++;
|
||||
}
|
||||
return nb;
|
||||
}
|
||||
|
||||
/* F3 : solde total de chaque client en O(n + c) */
|
||||
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++) {
|
||||
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++) {
|
||||
totaux[j] = 0;
|
||||
for (int i = 0; i < n; i++)
|
||||
if (t[i].jour == j)
|
||||
totaux[j] += t[i].montant;
|
||||
}
|
||||
}
|
||||
|
||||
/* F5 : période de jours consécutifs dont la somme des soldes est maximale */
|
||||
long meilleure_periode(const long *totaux, int nb_jours, int *debut, int *fin)
|
||||
{
|
||||
long meilleur = totaux[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;
|
||||
}
|
||||
}
|
||||
}
|
||||
return meilleur;
|
||||
}
|
||||
|
||||
/* F6 : retrouve une transaction à partir de son id */
|
||||
const Transaction *rechercher_par_id(const Transaction *t, int n, int id)
|
||||
{
|
||||
for (int i = 0; i < n; i++)
|
||||
if (t[i].id == id)
|
||||
return &t[i];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* F7 : nombre de paires de transactions de montants opposés (a + b = 0) */
|
||||
long nb_paires_opposees(const Transaction *t, int n)
|
||||
{
|
||||
long nb = 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++;
|
||||
return nb;
|
||||
}
|
||||
|
||||
/* F8 : nombre de façons de rendre une somme avec les pièces disponibles */
|
||||
static const int PIECES[] = {1, 2, 5, 10, 20, 50, 100, 200};
|
||||
#define NB_PIECES 8
|
||||
|
||||
long nb_facons_rendre(int somme, int nb_pieces)
|
||||
{
|
||||
if (somme == 0)
|
||||
return 1;
|
||||
if (somme < 0 || nb_pieces == 0)
|
||||
return 0;
|
||||
return nb_facons_rendre(somme - PIECES[nb_pieces - 1], nb_pieces) +
|
||||
nb_facons_rendre(somme, nb_pieces - 1);
|
||||
}
|
||||
|
||||
/* 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) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/* F10 : ajoute une ligne à la fin du rapport */
|
||||
int longueur(const char *s)
|
||||
{
|
||||
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++;
|
||||
}
|
||||
rapport[fin + i] = '\0';
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Programme principal (à adapter si vous changez les signatures) */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
unsigned long empreinte(const char *s)
|
||||
{
|
||||
unsigned long h = 1469598103934665603UL;
|
||||
for (int i = 0; s[i] != '\0'; i++) {
|
||||
h ^= (unsigned char)s[i];
|
||||
h *= 1099511628211UL;
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
Transaction *t = generer_transactions(NB_TRANSACTIONS);
|
||||
char *rapport = malloc(1 << 20);
|
||||
char ligne[128];
|
||||
rapport[0] = '\0';
|
||||
|
||||
/* recherches par id, dans l'ordre d'origine */
|
||||
long somme_requetes = 0;
|
||||
unsigned long etat = 12345;
|
||||
for (int q = 0; q < NB_REQUETES; q++) {
|
||||
etat = etat * 1103515245UL + 12345UL;
|
||||
const Transaction *r = rechercher_par_id(t, NB_TRANSACTIONS, (int)((etat >> 8) % NB_TRANSACTIONS));
|
||||
if (r != NULL)
|
||||
somme_requetes += r->montant;
|
||||
}
|
||||
|
||||
int nb_clients = nb_clients_distincts(t, NB_TRANSACTIONS);
|
||||
|
||||
static long totaux_clients[NB_CLIENTS];
|
||||
total_par_client(t, NB_TRANSACTIONS, totaux_clients);
|
||||
|
||||
static long totaux_jours[NB_JOURS];
|
||||
total_par_jour(t, NB_TRANSACTIONS, totaux_jours);
|
||||
int debut, fin;
|
||||
long meilleure = meilleure_periode(totaux_jours, NB_JOURS, &debut, &fin);
|
||||
|
||||
long nb_paires = nb_paires_opposees(t, NB_TRANSACTIONS);
|
||||
|
||||
int categories[12] = {0};
|
||||
for (int i = 0; i < NB_TRANSACTIONS; i++)
|
||||
categories[categorie(&t[i])]++;
|
||||
|
||||
trier_par_montant(t, NB_TRANSACTIONS);
|
||||
|
||||
long nb_facons = nb_facons_rendre(MONTANT_MONNAIE, NB_PIECES);
|
||||
|
||||
/* rapport */
|
||||
snprintf(ligne, sizeof(ligne), "clients distincts;%d\n", nb_clients);
|
||||
ajouter_ligne(rapport, ligne);
|
||||
snprintf(ligne, sizeof(ligne), "somme des requetes;%ld\n", somme_requetes);
|
||||
ajouter_ligne(rapport, ligne);
|
||||
snprintf(ligne, sizeof(ligne), "meilleure periode;%d;%d;%ld\n", debut, fin, meilleure);
|
||||
ajouter_ligne(rapport, ligne);
|
||||
snprintf(ligne, sizeof(ligne), "paires opposees;%ld\n", nb_paires);
|
||||
ajouter_ligne(rapport, ligne);
|
||||
snprintf(ligne, sizeof(ligne), "facons de rendre %d;%ld\n", MONTANT_MONNAIE, nb_facons);
|
||||
ajouter_ligne(rapport, ligne);
|
||||
for (int c = 0; c < 12; c++) {
|
||||
snprintf(ligne, sizeof(ligne), "categorie;%d;%d\n", c, categories[c]);
|
||||
ajouter_ligne(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);
|
||||
}
|
||||
for (int j = 0; j < NB_JOURS; j++) {
|
||||
snprintf(ligne, sizeof(ligne), "jour;%d;%ld\n", j, totaux_jours[j]);
|
||||
ajouter_ligne(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);
|
||||
}
|
||||
|
||||
FILE *f = fopen("rapport.txt", "w");
|
||||
if (f != NULL) {
|
||||
fputs(rapport, f);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
printf("Clients distincts : %d\n", nb_clients);
|
||||
printf("Somme des requêtes : %ld\n", somme_requetes);
|
||||
printf("Meilleure période : jours %d à %d (%ld)\n", debut, fin, meilleure);
|
||||
printf("Paires opposées : %ld\n", nb_paires);
|
||||
printf("Façons de rendre %d : %ld\n", MONTANT_MONNAIE, nb_facons);
|
||||
printf("Empreinte : %016lx\n", empreinte(rapport));
|
||||
|
||||
free(rapport);
|
||||
free(t);
|
||||
return 0;
|
||||
}
|
||||
=======
|
||||
/*
|
||||
* R5.A.04 - Qualité Algorithmique
|
||||
* TD Complexité algorithmique : analyse des transactions d'une banque
|
||||
@@ -73,33 +407,32 @@ Transaction *generer_transactions(int n)
|
||||
/* F1 : trie les transactions par montant croissant, puis par 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;
|
||||
}
|
||||
for (int i = 1; i < n; i++) {
|
||||
Transaction cle = t[i];
|
||||
int j = i - 1;
|
||||
while (j >= 0 && (t[j].montant > cle.montant ||
|
||||
(t[j].montant == cle.montant && t[j].id > cle.id))) {
|
||||
t[j + 1] = t[j];
|
||||
j--;
|
||||
}
|
||||
t[j + 1] = cle;
|
||||
}
|
||||
}
|
||||
|
||||
/* F2 : nombre de clients ayant au moins une transaction */
|
||||
int nb_clients_distincts(const Transaction *t, int n)
|
||||
{
|
||||
int clients_vus[NB_CLIENTS] = {0};
|
||||
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)
|
||||
int client = t[i].client;
|
||||
if (!clients_vus[client]) {
|
||||
clients_vus[client] = 1;
|
||||
nb++;
|
||||
}
|
||||
}
|
||||
|
||||
return nb;
|
||||
}
|
||||
|
||||
@@ -119,10 +452,10 @@ void total_par_jour(const Transaction *t, int n, long *totaux)
|
||||
{
|
||||
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++)
|
||||
totaux[t[i].jour] += t[i].montant;
|
||||
}
|
||||
|
||||
/* F5 : période de jours consécutifs dont la somme des soldes est maximale */
|
||||
@@ -330,3 +663,4 @@ int main(void)
|
||||
free(t);
|
||||
return 0;
|
||||
}
|
||||
>>>>>>> 97155f26889184ac9ab593d6aadb23cbdbce96c2
|
||||
|
||||
@@ -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