79 lines
2.6 KiB
Plaintext
79 lines
2.6 KiB
Plaintext
Exercice 1
|
|
|
|
Pour compiler le code : gcc -pg -std=c99 Exo1.c
|
|
|
|
Exercice 2
|
|
pour compiler le code : gcc -pg -std=c99 Exo2.c
|
|
|
|
Pour profiler avec gprof on entre la commande gprof ./a.out après avoir compiler le code
|
|
|
|
Flat profile:
|
|
|
|
Each sample counts as 0.01 seconds.
|
|
% cumulative self self total
|
|
time seconds seconds calls s/call s/call name
|
|
100.23 13.59 13.59 10000 0.00 0.00 racineCarree
|
|
0.00 13.59 0.00 1 0.00 13.59 racineCarreeTab
|
|
|
|
Call graph (explanation follows)
|
|
|
|
|
|
granularity: each sample hit covers 2 byte(s) for 0.07% of 13.59 seconds
|
|
|
|
index % time self children called name
|
|
13.59 0.00 10000/10000 racineCarreeTab [2]
|
|
[1] 100.0 13.59 0.00 10000 racineCarree [1]
|
|
-----------------------------------------------
|
|
0.00 13.59 1/1 main [3]
|
|
[2] 100.0 0.00 13.59 1 racineCarreeTab [2]
|
|
13.59 0.00 10000/10000 racineCarree [1]
|
|
-----------------------------------------------
|
|
<spontaneous>
|
|
[3] 100.0 0.00 13.59 main [3]
|
|
0.00 13.59 1/1 racineCarreeTab [2]
|
|
-----------------------------------------------
|
|
|
|
complexité cyclomatique
|
|
|
|
racineCarree() = 5
|
|
racineCarreeTab() = 2
|
|
|
|
Complexité algorithmique
|
|
|
|
racineCarree() = O(n)
|
|
racineCarreeTab() = O(t*n) avec t = taille du tableau
|
|
|
|
Exercice 3
|
|
|
|
Pour compiler : gcc -pg -std=c99 Exo3.c
|
|
|
|
Exercice 4
|
|
|
|
Pour profiler avec gprof on entre la commande gprof ./a.out après avoir compiler le code
|
|
|
|
Flat profile:
|
|
|
|
Each sample counts as 0.01 seconds.
|
|
no time accumulated
|
|
|
|
% cumulative self self total
|
|
time seconds seconds calls Ts/call Ts/call name
|
|
0.00 0.00 0.00 6 0.00 0.00 racineCarree
|
|
0.00 0.00 0.00 1 0.00 0.00 TriSpecial
|
|
|
|
Call graph (explanation follows)
|
|
|
|
|
|
granularity: each sample hit covers 2 byte(s) no time propagated
|
|
|
|
index % time self children called name
|
|
0.00 0.00 6/6 TriSpecial [2]
|
|
[1] 0.0 0.00 0.00 6 racineCarree [1]
|
|
-----------------------------------------------
|
|
0.00 0.00 1/1 main [6]
|
|
[2] 0.0 0.00 0.00 1 TriSpecial [2]
|
|
0.00 0.00 6/6 racineCarree [1]
|
|
-----------------------------------------------
|
|
|
|
La complexité cyclomatique de TriSpecial() est de 10
|
|
La complexité algorithmique de TriSpecial() est O(t*n) avec t la taille du tableau |