Skip to content

Commit

Permalink
L29 cosmetic
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklam committed Sep 17, 2024
1 parent 1e0542c commit e4b3c99
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 9 additions & 6 deletions lectures/L29-slides.tex
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ \part{Liar, Liar}
\frametitle{Assumptions}

The main assumptions underlying sampling are that:
\vspace*{-6em}
\begin{itemize}
\item Samples are ``random''; and

Samples are ``random''; and

The sample distribution approximates the actual time-spent distribution.
\item The sample distribution approximates the actual time-spent distribution.
\end{itemize}

\end{frame}

Expand Down Expand Up @@ -84,11 +86,12 @@ \part{Lies from Metrics}
mostly we'll talk about CPU perf counters.


\vspace*{-6em}


\begin{center}
Reference: Paul Khuong,\\
\tiny
\scriptsize
\url{http://www.pvk.ca/Blog/2014/10/19/performance-optimisation-~-writing-an-essay/}

\end{center}
Expand Down Expand Up @@ -357,7 +360,7 @@ \part{Lies from Counters}

To make counters as deterministic as possible:
\begin{itemize}
\item disable Address Space Layout Randomization (randomized pointer addresses affect hash layouts);
\item disable Address Space Layout Randomization (security mitigation; but, randomized pointer addresses affect hash layouts);
\item subtract time spent processing interrupts (IRQs);
\item profile one thread only (if you can, in your context).
\end{itemize}
Expand Down Expand Up @@ -396,7 +399,7 @@ \part{Lies about Calling Context}

\begin{center}
Reference: Yossi Kreinin,\\
\tiny
\scriptsize
\url{http://www.yosefk.com/blog/how-profilers-lie-the-cases-of-gprof-and-kcachegrind.html}
\end{center}

Expand Down
6 changes: 3 additions & 3 deletions lectures/L29.tex
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ \section*{Lies from Metrics}
\end{tabular}

That 15\% number is a total lie.
Profilers, even using CPU expense counts, drastically underestimate the impact of mfence,
Profilers, even using CPU counts, drastically underestimate the impact of mfence,
and overestimate the impact of locks.

This is because mfence causes a pipeline flush, and the resulting
Expand Down Expand Up @@ -149,7 +149,7 @@ \section*{The Long Tail}

Well, for one thing, perf samples are done with interrupts. Processing interrupts takes a fair amount of time and if you crank up the rate of interrupts, before long, you are spending all your time handling the interrupts rather than doing useful work. So sampling tools usually don't interrupt the program too often. SHIM gets around this by being more invasive---it instruments the program, adding some periodically executed code that puts information out whenever there is an appropriate event (e.g., function return). This produces a bunch of data which can be dealt with later to produce something useful.

This instrumentation-based approach is more expensive in general, but note that DTrace\footnote{Note also the comment in the blog post: ``Yes, that includes dtrace, which I'm calling out in particular because any time you have one of these discussions, a dtrace troll will come along to say that dtrace has supported that for years. It's like the common lisp of trace tools, in terms of community trolling.''} and Nethercote's counts tool (discussed in L25) also enable custom instrumentation of select events.
This instrumentation-based approach is more expensive in general, but note that DTrace\footnote{Note also the comment in the blog post: ``Yes, that includes dtrace, which I'm calling out in particular because any time you have one of these discussions, a dtrace troll will come along to say that dtrace has supported that for years. It's like the common lisp of trace tools, in terms of community trolling.''} and Nethercote's counts tool (discussed in L27) also enable custom instrumentation of select events.

\section*{Lies from Counters}
This is fairly niche, but Rust compiler hackers were trying to include
Expand All @@ -161,7 +161,7 @@ \section*{Lies from Counters}

To make counters as deterministic as possible:
\begin{itemize}[noitemsep]
\item disable Address Space Layout Randomization (randomized pointer addresses affect hash layouts);
\item disable Address Space Layout Randomization (security mitigation; but, randomized pointer addresses affect hash layouts);
\item subtract time spent processing interrupts (IRQs);
\item profile one thread only (if you can, in your context).
\end{itemize}
Expand Down

0 comments on commit e4b3c99

Please sign in to comment.