We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.-- Donald E. Knuth
reducersto ensure we make the best calls regarding what states to explore, filter and defer.
decide. We can generate a CPU profile for our model using a particular set of input data as shown.
apps/dispatch/cmd/base-clidirectory. First, we need to create our profile data so we can provide it to
pprofand generate the visualization. Be sure to run the model for at least a second, since profile samples are collected at one-second intervals. Otherwise,
pprofwill have nothing to work with.
httpflag, providing an address and port at which to serve visualizations for a web browser.
base-cliis the name of the binary file to profile; in this case the same binary we ran above. Similarly,
base-cli.profis the same file containing profiling data that we created in the example above.
pproftool is running, we are presented with a graph depicting the chain of function calls made while profile samples were being collected:
code/dash/examples/queuedirectory. First, like before, we need to create our profile data file:
pprofso we can see how our simulation may be tweaked.
queuein the example below refers to the binary created when running
queue.profis the profile data file created by adding
-dash-runner.profile.cpu queue.profwhen executing a Dash simulation.