Flat profile: Each sample counts as 0.00195312 seconds. % cumulative self self total time seconds seconds calls ms/call ms/call name 89.12 16.90 16.90 3283200 0.01 0.01 write // // La fonction qui a le plus pese dans le temps d'execution du programme // est la fonction write (son execution represente 89.12% du temps // total d'execution). Vu son temps d'execution pour chaque appel (0.01 ms), // c'est le nombre d'appels qui ont ete faits vers cette focntion (3283200) // qui fait qu'elle pese lourd. // 3.30 17.52 0.62 __mcount_internal 2.97 18.08 0.56 6553600 0.00 0.00 memset 1.69 18.40 0.32 3276800 0.00 0.00 memcpy 1.08 18.61 0.21 mcount 0.84 18.77 0.16 1 160.16 17304.95 ecritMethode1 // // ecritMethode1 a pris 17304.95 ms = ~17.3 secondes // 0.59 18.88 0.11 1 111.33 823.95 ecritMethode2 // // ecritMethode2 a pris 823.95 ms = ~0.8 secondes. ecritMethode2 est // 17304.95/823.95 ~ 21 fois plus rapide que ecritMethode1. // 0.41 18.96 0.08 3276800 0.00 0.00 ecritBuf 0.00 18.96 0.00 2 0.00 0.00 close 0.00 18.96 0.00 2 0.00 0.00 fermeFic 0.00 18.96 0.00 2 0.00 0.00 open 0.00 18.96 0.00 2 0.00 0.00 ouvrirFicEcriture 0.00 18.96 0.00 1 0.00 0.00 __cxa_atexit 0.00 18.96 0.00 1 0.00 0.00 __new_exitfn 0.00 18.96 0.00 1 0.00 0.00 _mcleanup 0.00 18.96 0.00 1 0.00 0.00 atexit 0.00 18.96 0.00 1 0.00 0.00 exit 0.00 18.96 0.00 1 0.00 0.01 flushBuf 0.00 18.96 0.00 1 0.00 18128.91 main 0.00 18.96 0.00 1 0.00 0.00 setitimer 0.00 18.96 0.00 1 0.00 0.00 sigaction % 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. Call graph (explanation follows) granularity: each sample hit covers 4 byte(s) for 0.01% of 18.13 seconds index % time self children called name 0.00 18.13 1/1 __libc_start_main [2] [1] 100.0 0.00 18.13 1 main [1] 0.16 17.14 1/1 ecritMethode1 [3] 0.11 0.71 1/1 ecritMethode2 [5] ----------------------------------------------- [2] 100.0 0.00 18.13 __libc_start_main [2] 0.00 18.13 1/1 main [1] ----------------------------------------------- 0.16 17.14 1/1 main [1] [3] 95.5 0.16 17.14 1 ecritMethode1 [3] 16.86 0.00 3276800/3283200 write [4] 0.28 0.00 3276800/6553600 memset [6] 0.00 0.00 1/2 ouvrirFicEcriture [13] 0.00 0.00 1/2 fermeFic [11] // // L'execution du code propre de ecritMethode1 et de ses sous-fonctions // represente 95.5% du temps d'execution du programme. // ecritMethode1 a passe 0.16 seconde dans son propre code et 17.14 secondes // dans des sous-fonctions appelees par ecritMethode1. // 16.86 secondes ont ete passees dans la sous-fonction write (ecritMethode1 // est responsable de 3276800 des 3283200 appels a write) et 0.28 seconde // dans la methode memset. Il faut donc reduire le nombre de write pour // ameliorer les choses (ce que fait ecritMethode2). // ----------------------------------------------- 0.00 0.00 1/3283200 flushBuf [9] 0.03 0.00 6399/3283200 ecritBuf [7] 16.86 0.00 3276800/3283200 ecritMethode1 [3] [4] 93.2 16.90 0.00 3283200 write [4] // // Le gros des appels a write est le fait de ecritMethode1 (ecritBuf est // un "petit joueur" avec ses 6399 appels). // ----------------------------------------------- 0.11 0.71 1/1 main [1] [5] 4.5 0.11 0.71 1 ecritMethode2 [5] 0.08 0.35 3276800/3276800 ecritBuf [7] 0.28 0.00 3276800/6553600 memset [6] 0.00 0.00 1/1 flushBuf [9] 0.00 0.00 1/2 ouvrirFicEcriture [13] 0.00 0.00 1/2 fermeFic [11] // // On constate que 0.28/(0.11+0.71) = 34% du temps de ecritMethode2 est // perdu dans la fonction memset. Cela signifie qu'on aurait probablement // interet a trouver un methode d'optimisation (par exemple de l'inlining) // pour encore plus optimiser. // ----------------------------------------------- 0.28 0.00 3276800/6553600 ecritMethode1 [3] 0.28 0.00 3276800/6553600 ecritMethode2 [5] [6] 3.1 0.56 0.00 6553600 memset [6] ----------------------------------------------- 0.08 0.35 3276800/3276800 ecritMethode2 [5] [7] 2.4 0.08 0.35 3276800 ecritBuf [7] 0.32 0.00 3276800/3276800 memcpy [8] 0.03 0.00 6399/3283200 write [4] // // 0.32/(0.08+0.35) = 74% du temps de ecritBuf est perdu dans memcpy. // On a interet a trouver une methode d'optimisation de memcpy. // ----------------------------------------------- 0.32 0.00 3276800/3276800 ecritBuf [7] [8] 1.8 0.32 0.00 3276800 memcpy [8] ----------------------------------------------- 0.00 0.00 1/1 ecritMethode2 [5] [9] 0.0 0.00 0.00 1 flushBuf [9] 0.00 0.00 1/3283200 write [4] ----------------------------------------------- 0.00 0.00 2/2 fermeFic [11] [10] 0.0 0.00 0.00 2 close [10] ----------------------------------------------- 0.00 0.00 1/2 ecritMethode1 [3] 0.00 0.00 1/2 ecritMethode2 [5] [11] 0.0 0.00 0.00 2 fermeFic [11] 0.00 0.00 2/2 close [10] ----------------------------------------------- 0.00 0.00 2/2 ouvrirFicEcriture [13] [12] 0.0 0.00 0.00 2 open [12] ----------------------------------------------- 0.00 0.00 1/2 ecritMethode1 [3] 0.00 0.00 1/2 ecritMethode2 [5] [13] 0.0 0.00 0.00 2 ouvrirFicEcriture [13] 0.00 0.00 2/2 open [12] ----------------------------------------------- 0.00 0.00 1/1 __gmon_start__ [458] [14] 0.0 0.00 0.00 1 atexit [14] 0.00 0.00 1/1 __cxa_atexit [292] ----------------------------------------------- 0.00 0.00 1/1 _start [605] [15] 0.0 0.00 0.00 1 exit [15] 0.00 0.00 1/1 _mcleanup [294] ----------------------------------------------- 0.00 0.00 1/1 profil [205] [16] 0.0 0.00 0.00 1 setitimer [16] ----------------------------------------------- 0.00 0.00 1/1 profil [205] [17] 0.0 0.00 0.00 1 sigaction [17] ----------------------------------------------- 0.00 0.00 1/1 atexit [14] [292] 0.0 0.00 0.00 1 __cxa_atexit [292] 0.00 0.00 1/1 __new_exitfn [293] ----------------------------------------------- 0.00 0.00 1/1 __cxa_atexit [292] [293] 0.0 0.00 0.00 1 __new_exitfn [293] ----------------------------------------------- 0.00 0.00 1/1 exit [15] [294] 0.0 0.00 0.00 1 _mcleanup [294] ----------------------------------------------- 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 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 `' 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. Index by function name [292] __cxa_atexit [3] ecritMethode1 [8] memcpy (470) __mcount_internal [5] ecritMethode2 [6] memset [293] __new_exitfn [15] exit [12] open [294] _mcleanup [11] fermeFic [13] ouvrirFicEcriture [14] atexit [9] flushBuf [16] setitimer [10] close [1] main [17] sigaction [7] ecritBuf (175) mcount [4] write