64
edits
Changes
m
4745.27 34 7.83 76 7.83 76 622577597 0.00 0.00 checkRow(int, int) 18.63 10.92 94 3.09 19 223365661 0.00 0.00 checkColumn(int, int) 14.18 38 13.27 40 2.35 46 157353814 0.00 0.00 placeNum(int, int) 1113.49 24 15.17 67 12.90 27 100608583 0.00 0.00 checkSquare(int, int, int) 4.29 80 1516.89 49 0.71 82 69175252 0.00 0.00 goBack(int&, int&) 3.93 46 1617.54 08 0.65 59 1 0.65 59 1617.54 08 solveSudoku() 0.21 29 1617.57 13 0.04 05 1 0.04 05 0.04 05 _GLOBAL__sub_I_sudoku 0.00 1617.57 13 0.00 2 0.00 0.00 print(int (*) [9]) 0.00 1617.57 13 0.00 1 0.00 0.00 _GLOBAL__sub_I_temp 0.00 1617.57 13 0.00 1 0.00 0.00 storePositions() 0.00 1617.57 13 0.00 1 0.00 0.00 __static_initialization_and_destruction_0(int, int) 0.00 1617.57 13 0.00 1 0.00 0.00 __static_initialization_and_destruction_0(int, int)
87.54 76 0.00 622577597/622577597 placeNum(int, int) [3] [4] 4945.1 3 87.54 76 0.00 622577597 checkRow(int, int) [4]
→Assignment 1
'''Analysis'''
The analysis reveals that the program took no time in solving this puzzle. However, the function placeNum was checkRow and checkColumn were called the most. The function solveSudoku is These two functions are used for inserting values into empty elements, and placeNum does the testing checking whether or not the value is row and columns are correct. For a deeper analysis, a harder puzzle must be used.
% cumulative self self total
time seconds seconds calls s/call s/call name
Call graph
granularity: each sample hit covers 2 byte(s) for 0.06% of 17.42 13 seconds
index % time self children called name
<spontaneous>
[1] 99.8 7 0.00 17.38 08 main [1] 0.41 59 16.97 49 1/1 solveSudoku() [2]
0.00 0.00 2/2 print(int (*) [9]) [16]
0.00 0.00 1/1 storePositions() [18]
-----------------------------------------------
0.41 59 16.97 49 1/1 main [1] [2] 99.8 7 0.41 59 16.97 49 1 solveSudoku() [2] 2.41 46 13.70 21 157353814/157353814 placeNum(int, int) [3] 0.87 82 0.00 69175252/69175252 goBack(int&, int&) [7]
-----------------------------------------------
2.41 46 13.70 21 157353814/157353814 solveSudoku() [2] [3] 9291.4 5 2.41 46 13.70 21 157353814 placeNum(int, int) [3] 87.54 76 0.00 622577597/622577597 checkRow(int, int) [4] 3.04 19 0.00 223365661/223365661 checkColumn(int, int) [5] 2.11 27 0.00 100608583/100608583 checkSquare(int, int, int) [6]
-----------------------------------------------
-----------------------------------------------
3.04 19 0.00 223365661/223365661 placeNum(int, int) [3] [5] 1718.4 6 3.04 19 0.00 223365661 checkColumn(int, int) [5]
-----------------------------------------------
2.11 27 0.00 100608583/100608583 placeNum(int, int) [3] [6] 1213.1 2 2.11 27 0.00 100608583 checkSquare(int, int, int) [6]
-----------------------------------------------
0.87 82 0.00 69175252/69175252 solveSudoku() [2] [7] 54.0 8 0.87 82 0.00 69175252 goBack(int&, int&) [7]
-----------------------------------------------
0.04 05 0.00 1/1 __libc_csu_init [9] [8] 0.2 3 0.04 05 0.00 1 _GLOBAL__sub_I_sudoku [8]
0.00 0.00 1/1 __static_initialization_and_destruction_0(int, int) [19]
-----------------------------------------------
<spontaneous>
[9] 0.2 3 0.00 0.04 05 __libc_csu_init [9] 0.04 05 0.00 1/1 _GLOBAL__sub_I_sudoku [8]
0.00 0.00 1/1 _GLOBAL__sub_I_temp [17]
-----------------------------------------------
'''Analysis'''
With a harder puzzle, the time for the program to solve the puzzle increased significantly. The total time to complete this puzzle was 17.13 seconds. The program spends almost half of its running time checking if the row is correct, and another 18% of its time checking whether the column is correct. This program contains thousands of calls to check the row and column values, this is why the program would be excellent project for parallelizing.