Changes

Jump to: navigation, search

Algo holics

2,202 bytes added, 04:42, 22 February 2019
Assignment 1
<h5>Analysis</h5>
To analyze the flat profilecall graph, enter the following command: gprof -p q -b a> a.fltclg-q directs the profiler (gprof) to output a call graph. -b directs the profiler to omit detailed explanations of the column headings from the output.
-p directs the profiler (gprof) to output a flat profile. Call graph
-b directs the profiler to omit detailed explanations of the column headings from the output.
granularity: each sample hit covers 2 byte(s) no time propagated
Flat profile: Each sample counts as 0.01 seconds. no index % time accumulated % cumulative self self total time seconds seconds children calls Ts/call Ts/call called name 0.00 0.00 4539/4539 placeNum(int, int) [10][8] 0.00 4539 0 0.00 0.00 4539 checkRow(int, int)[8] ----------------------------------------------- 0.00 0.00 1620/1620 placeNum(int, int) [10][9] 0.00 1620 0 0.00 0.00 1620 checkColumn(int, int)[9]----------------------------------------------- 0.00 0.00 1120/1120 solveSudoku() [16][10] 0.00 0.00 0.00 1120 placeNum(int, int) [10] 0.00 0.00 4539/4539 checkRow(int, int) [8] 0.00 0.00 placeNum 1620/1620 checkColumn(int, int)[9] 0.00 0.00 698/698 checkSquare(int, int, int) [11]----------------------------------------------- 0.00 0.00 698/698 placeNum(int, int) [10][11] 0.00 0.00 0.00 698 checkSquare(int, int, int)[11]----------------------------------------------- 0.00 0.00 476/476 solveSudoku() [16][12] 0.00 476 0 0.00 0.00 476 goBack(int&, int&)[12]----------------------------------------------- 0.00 0.00 2/2 main [6][13] 0.00 2 0 0.00 0.00 2 print(int (*) [9])[13]----------------------------------------------- 0.00 0.00 1/1 __libc_csu_init [30][14] 0.00 1 0 0.00 0.00 1 _GLOBAL__sub_I_sudoku[14] 0.00 0.00 1/1 __static_initialization_and_destruction_0(int, int) [18]----------------------------------------------- 0.00 0.00 1/1 __libc_csu_init [30][15] 0.00 0.00 0.00 1 _GLOBAL__sub_I_temp[15] 0.00 0.00 1/1 __static_initialization_and_destruction_0(int, int) [19]----------------------------------------------- 0.00 0.00 1/1 main [6][16] 0.00 0.00 0.00 1 solveSudoku()[16] 0.00 0.00 1120/1120 placeNum(int, int) [10] 0.00 0.00 476/476 goBack(int&, int&) [12]----------------------------------------------- 0.00 0.00 1/1 main [6][17] 0.00 0.00 0.00 1 storePositions()[17]----------------------------------------------- 0.00 0.00 1/1 _GLOBAL__sub_I_sudoku [14][18] 0.00 1 0 0.00 0.00 1 __static_initialization_and_destruction_0(int, int)[18]----------------------------------------------- 0.00 0.00 1/1 _GLOBAL__sub_I_temp [15][19] 0.00 1 0 0.00 0.00 1 __static_initialization_and_destruction_0(int, int)[19]-----------------------------------------------
Index by function name  [14] _GLOBAL__sub_I_sudoku [16] solveSudoku() [13] print(int (*) [9]) [15] _GLOBAL__sub_I_temp [17] storePositions() [12] goBack(int&, int&) [9] checkColumn(int, int) [18] __static_initialization_and_destruction_0(int, int) [8] checkRow(int, int) [11] checkSquare(int, int, int) [19] __static_initialization_and_destruction_0(int, int) [10] placeNum(int, int)     From the above Flat profile we can see that the program took no time in finding the solution and the function checkRow, checkColumn and placeNum were called for the maximum times. However, to get a better understanding of the program let's try a harder Sudoku puzzle.
If we run the sample-puzzle-2-hard (Level- hard) file, which has the following text inside it:
85
edits

Navigation menu