No Profiler only Timing
In this example we are trying to sign the hash output of a message.
Each message and signing key being unique.
At the end of each job the output is send to the main program.
Initially we would try to see how much time it takes.
This program is designed to run on Multiple CPUs.
But some times it might not. Its dependent on the Goruitine
scheduler.
Measuring Time on Linux
Its easy to do:
go build main.go
time ./main
Measuring Time on Windows
First we build the program:
go build main.go
That would give us main.exe
.
Now there is no way to measure execution time other than PowerShell
tricks in Windows.
Hence we would use the most obvious trick in cmd
prompt:
C:\....> echo %time% < nul
C:\....> main.exe
C:\....> echo %time% < nul
We have added this to the timer.bat
file here.
Look at the timer.cmd
file for the whole design.
But its much difficult to find out this way.
Git-for-Windows Shell
We found the best solution is to use Git CMD
that comes with git for windows
.
There we can do this:
time ./main.exe
Conclusion
Though we are able to see the timing we don't know howmuch time each operation is taking.
We also don't know if the Goroutines
are running on multiple CPU or are co-operatively scheduled.
We look at the next piece of the go tooling called pprof
or Profiling.