Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d95a3f2a2 | |||
| 25c08dc33f |
@@ -71,18 +71,16 @@ Transaction *generer_transactions(int n)
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* F1 : trie les transactions par montant croissant, puis par id */
|
||||
int compareFunction(const void *ptr1, const void *ptr2){
|
||||
const Transaction *t1 = ptr1, *t2 = ptr2;
|
||||
if(t1->montant != t2->montant)
|
||||
return (t1->montant > t2->montant) - (t1->montant < t2->montant);
|
||||
return (t1->id > t2->id) - (t1->id < t2->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(Transaction), compareFunction);
|
||||
}
|
||||
|
||||
/* F2 : nombre de clients ayant au moins une transaction */
|
||||
@@ -183,32 +181,29 @@ long nb_facons_rendre(int somme, int nb_pieces)
|
||||
/* F9 : catégorie d'une transaction (pour les statistiques) */
|
||||
int categorie(const Transaction *t)
|
||||
{
|
||||
bool weekend = t->jour % 7 >= 5;
|
||||
bool debut_mois = t->jour % 30 == 0;
|
||||
bool client_rond = t->client % 10 == 0;
|
||||
|
||||
if (t->montant == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (t->montant < 0) {
|
||||
if (t->montant < -20000) {
|
||||
if (t->jour % 7 == 5 || t->jour % 7 == 6)
|
||||
return 1;
|
||||
else
|
||||
return 2;
|
||||
return 2-weekend;
|
||||
} else if (t->montant < -5000) {
|
||||
return 3;
|
||||
} else {
|
||||
if (t->client % 10 == 0)
|
||||
return 4;
|
||||
return 5;
|
||||
return 5 - client_rond;
|
||||
}
|
||||
} 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;
|
||||
return 7 - (client_rond && !weekend);
|
||||
} else if (t->montant > 10000) {
|
||||
return 8;
|
||||
} else if (t->montant > 1000) {
|
||||
if (t->jour % 30 == 0)
|
||||
return 9;
|
||||
return 10;
|
||||
return 10 - debut_mois;
|
||||
}
|
||||
return 11;
|
||||
}
|
||||
|
||||
Regular → Executable
@@ -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
|
||||
48.67 2.93 2.93 1 2.93 2.93 trier_par_montant
|
||||
12.96 3.71 0.78 30000 0.00 0.00 rechercher_par_id
|
||||
11.96 4.43 0.72 1 0.72 0.72 nb_paires_opposees
|
||||
8.89 4.96 0.54 1 0.54 0.54 nb_facons_rendre
|
||||
7.14 5.39 0.43 6017 0.00 0.00 longueur
|
||||
4.82 5.68 0.29 1 0.29 0.29 meilleure_periode
|
||||
1.83 5.79 0.11 1 0.11 0.11 total_par_client
|
||||
1.50 5.88 0.09 1 0.09 0.09 nb_clients_distincts
|
||||
0.83 5.93 0.05 1 0.05 0.05 total_par_jour
|
||||
0.75 5.98 0.04 30000 0.00 0.00 categorie
|
||||
0.66 6.02 0.04 _init
|
||||
0.00 6.02 0.00 149998 0.00 0.00 alea
|
||||
0.00 6.02 0.00 6017 0.00 0.00 ajouter_ligne
|
||||
0.00 6.02 0.00 1 0.00 0.00 empreinte
|
||||
0.00 6.02 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.17% of 6.02 seconds
|
||||
|
||||
index % time self children called name
|
||||
<spontaneous>
|
||||
[1] 99.3 0.00 5.98 main [1]
|
||||
2.93 0.00 1/1 trier_par_montant [2]
|
||||
0.78 0.00 30000/30000 rechercher_par_id [3]
|
||||
0.72 0.00 1/1 nb_paires_opposees [4]
|
||||
0.54 0.00 1/1 nb_facons_rendre [5]
|
||||
0.00 0.43 6017/6017 ajouter_ligne [6]
|
||||
0.29 0.00 1/1 meilleure_periode [8]
|
||||
0.11 0.00 1/1 total_par_client [9]
|
||||
0.09 0.00 1/1 nb_clients_distincts [10]
|
||||
0.05 0.00 1/1 total_par_jour [11]
|
||||
0.04 0.00 30000/30000 categorie [12]
|
||||
0.00 0.00 1/1 generer_transactions [16]
|
||||
0.00 0.00 1/1 empreinte [15]
|
||||
-----------------------------------------------
|
||||
2.93 0.00 1/1 main [1]
|
||||
[2] 48.7 2.93 0.00 1 trier_par_montant [2]
|
||||
-----------------------------------------------
|
||||
0.78 0.00 30000/30000 main [1]
|
||||
[3] 13.0 0.78 0.00 30000 rechercher_par_id [3]
|
||||
-----------------------------------------------
|
||||
0.72 0.00 1/1 main [1]
|
||||
[4] 12.0 0.72 0.00 1 nb_paires_opposees [4]
|
||||
-----------------------------------------------
|
||||
266723738 nb_facons_rendre [5]
|
||||
0.54 0.00 1/1 main [1]
|
||||
[5] 8.9 0.54 0.00 1+266723738 nb_facons_rendre [5]
|
||||
266723738 nb_facons_rendre [5]
|
||||
-----------------------------------------------
|
||||
0.00 0.43 6017/6017 main [1]
|
||||
[6] 7.1 0.00 0.43 6017 ajouter_ligne [6]
|
||||
0.43 0.00 6017/6017 longueur [7]
|
||||
-----------------------------------------------
|
||||
0.43 0.00 6017/6017 ajouter_ligne [6]
|
||||
[7] 7.1 0.43 0.00 6017 longueur [7]
|
||||
-----------------------------------------------
|
||||
0.29 0.00 1/1 main [1]
|
||||
[8] 4.8 0.29 0.00 1 meilleure_periode [8]
|
||||
-----------------------------------------------
|
||||
0.11 0.00 1/1 main [1]
|
||||
[9] 1.8 0.11 0.00 1 total_par_client [9]
|
||||
-----------------------------------------------
|
||||
0.09 0.00 1/1 main [1]
|
||||
[10] 1.5 0.09 0.00 1 nb_clients_distincts [10]
|
||||
-----------------------------------------------
|
||||
0.05 0.00 1/1 main [1]
|
||||
[11] 0.8 0.05 0.00 1 total_par_jour [11]
|
||||
-----------------------------------------------
|
||||
0.04 0.00 30000/30000 main [1]
|
||||
[12] 0.7 0.04 0.00 30000 categorie [12]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[13] 0.7 0.04 0.00 _init [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
|
||||
|
||||
[13] _init [16] generer_transactions [4] nb_paires_opposees
|
||||
[6] ajouter_ligne [7] longueur [3] rechercher_par_id
|
||||
[14] alea [8] meilleure_periode [9] total_par_client
|
||||
[12] categorie [10] nb_clients_distincts [11] total_par_jour
|
||||
[15] empreinte [5] nb_facons_rendre [2] trier_par_montant
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
Flat profile:
|
||||
|
||||
Each sample counts as 0.01 seconds.
|
||||
% cumulative self self total
|
||||
time seconds seconds calls s/call s/call name
|
||||
49.84 3.03 3.03 1 3.03 3.03 trier_par_montant
|
||||
13.16 3.83 0.80 30000 0.00 0.00 rechercher_par_id
|
||||
12.17 4.57 0.74 1 0.74 0.74 nb_paires_opposees
|
||||
7.32 5.01 0.45 1 0.45 0.45 nb_facons_rendre
|
||||
6.41 5.41 0.39 6017 0.00 0.00 longueur
|
||||
5.10 5.71 0.31 1 0.31 0.31 meilleure_periode
|
||||
1.97 5.83 0.12 1 0.12 0.12 total_par_client
|
||||
1.64 5.93 0.10 1 0.10 0.10 nb_clients_distincts
|
||||
0.82 5.99 0.05 1 0.05 0.05 total_par_jour
|
||||
0.82 6.04 0.05 _init
|
||||
0.58 6.07 0.04 30000 0.00 0.00 categorie
|
||||
0.16 6.08 0.01 main
|
||||
0.00 6.08 0.00 149998 0.00 0.00 alea
|
||||
0.00 6.08 0.00 6017 0.00 0.00 ajouter_ligne
|
||||
0.00 6.08 0.00 1 0.00 0.00 empreinte
|
||||
0.00 6.08 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.16% of 6.08 seconds
|
||||
|
||||
index % time self children called name
|
||||
<spontaneous>
|
||||
[1] 99.2 0.01 6.02 main [1]
|
||||
3.03 0.00 1/1 trier_par_montant [2]
|
||||
0.80 0.00 30000/30000 rechercher_par_id [3]
|
||||
0.74 0.00 1/1 nb_paires_opposees [4]
|
||||
0.45 0.00 1/1 nb_facons_rendre [5]
|
||||
0.00 0.39 6017/6017 ajouter_ligne [6]
|
||||
0.31 0.00 1/1 meilleure_periode [8]
|
||||
0.12 0.00 1/1 total_par_client [9]
|
||||
0.10 0.00 1/1 nb_clients_distincts [10]
|
||||
0.05 0.00 1/1 total_par_jour [11]
|
||||
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]
|
||||
-----------------------------------------------
|
||||
3.03 0.00 1/1 main [1]
|
||||
[2] 49.8 3.03 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.74 0.00 1/1 main [1]
|
||||
[4] 12.2 0.74 0.00 1 nb_paires_opposees [4]
|
||||
-----------------------------------------------
|
||||
266723738 nb_facons_rendre [5]
|
||||
0.45 0.00 1/1 main [1]
|
||||
[5] 7.3 0.45 0.00 1+266723738 nb_facons_rendre [5]
|
||||
266723738 nb_facons_rendre [5]
|
||||
-----------------------------------------------
|
||||
0.00 0.39 6017/6017 main [1]
|
||||
[6] 6.4 0.00 0.39 6017 ajouter_ligne [6]
|
||||
0.39 0.00 6017/6017 longueur [7]
|
||||
-----------------------------------------------
|
||||
0.39 0.00 6017/6017 ajouter_ligne [6]
|
||||
[7] 6.4 0.39 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.12 0.00 1/1 main [1]
|
||||
[9] 2.0 0.12 0.00 1 total_par_client [9]
|
||||
-----------------------------------------------
|
||||
0.10 0.00 1/1 main [1]
|
||||
[10] 1.6 0.10 0.00 1 nb_clients_distincts [10]
|
||||
-----------------------------------------------
|
||||
0.05 0.00 1/1 main [1]
|
||||
[11] 0.8 0.05 0.00 1 total_par_jour [11]
|
||||
-----------------------------------------------
|
||||
<spontaneous>
|
||||
[12] 0.8 0.05 0.00 _init [12]
|
||||
-----------------------------------------------
|
||||
0.04 0.00 30000/30000 main [1]
|
||||
[13] 0.6 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
|
||||
|
||||
[12] _init [7] longueur [3] rechercher_par_id
|
||||
[6] ajouter_ligne [1] main [9] total_par_client
|
||||
[14] alea [8] meilleure_periode [11] total_par_jour
|
||||
[13] categorie [10] nb_clients_distincts [2] trier_par_montant
|
||||
[15] empreinte [5] nb_facons_rendre
|
||||
[16] generer_transactions [4] nb_paires_opposees
|
||||
+6017
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
zaabay;-;2230
|
||||
zaabay;-;946
|
||||
zaabay;-;913
|
||||
|
Reference in New Issue
Block a user