liveBook · Manning

CPU time

As explained in Experimentation for Engineers

CPU time is the amount of processor execution time consumed by a program or process.

CPU time is the processor time consumed while a program handles work. It can serve as the optimization metric for a JIT-compiled web server: lower CPU time means faster request handling and less risk that waiting users abandon a page. section 6.1

Figure 6.1 The JIT compiles web server source code. The speed (conversely, CPU time) of the compiled web server depends on the parameters used to configure the JIT.
06-01

The diagram links JIT configuration to the execution speed—and therefore CPU time—of compiled server code. section 6.1

Measure CPU time offline by configuring the JIT, compiling the server, and replaying production request logs on production-equivalent hardware. A run returns average CPU time, but operating-system activity, caching, and other factors can make repeated measurements vary. Treat the compiler and server as a black box: supply parameters and use the observed metric without relying on internal dynamics. section 6.1 section 6.1.1

Use CPU time in an optimization loop:

  • Start with an initial parameter setting, such as the center of the allowed range, and measure its CPU time. section 6.1.2
  • Fit a response-surface surrogate that estimates CPU time and uncertainty between measured parameter values. section 6.1.3 section 6.2.1
  • Choose another setting by balancing exploration of uncertain regions against exploitation of settings predicted to minimize CPU time. section 6.1.5
  • Repeat design, measurement, and analysis until measured CPU time or the proposed parameters stop changing. section 6.4.2

Estimating CPU time between measurements

With measurements of 1.56 at parameter 0.5 and 1.21 at parameter 0.0, a simple estimate is their mean, 1.375. A distance-weighted estimate at 0.4 instead gives more influence to the nearby 0.5 measurement; one illustrated weighting yields 1.458. Gaussian process regression generalizes this interpolation into a surrogate used to select later experiments. section 6.2.1

Each server measurement may take about an hour, so optimization cost matters. In the seven-parameter example, repeated measurements take roughly two days; automation handles experiment design and analysis while the engineer supplies the measured CPU times. section 6.4.2

How Experimentation for Engineers covers it

How deep it goes
Works through noisy offline measurement, response-surface estimation, Gaussian process regression, and an iterative stopping rule.
Examples
Uses production request-log replay, a Python JIT-plus-server simulator, and measurements at parameters 0.5 and 0.0.
What it assumes
Starts from zero measurements by initializing a parameter setting before building a CPU-time model.
What you can do after
Apply it via Bayesian optimization to compare JIT configurations and stop when CPU-time measurements stabilize.
How it connects
Connects CPU time with Bayesian optimization, black-box optimization, response surfaces, Gaussian process regression, and exploration versus exploitation.

Also explained in

Compare how 4 books explain CPU time →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Experimentation for Engineers. The section links point to the parts of the book it draws on.