freebsd-src/lib/libpmc
Jonathan T. Looney 828ddfb37d MFC r290811:
Fix hwpmc "stalled" behavior

  Currently, there is a single pm_stalled flag that tracks whether a
  performance monitor was "stalled" due to insufficent ring buffer
  space for samples. However, because the same performance monitor
  can run on multiple processes or threads at the same time, a single
  pm_stalled flag that impacts them all seems insufficient.

  In particular, you can hit corner cases where the code fails to stop
  performance monitors during a context switch out, because it thinks
  the performance monitor is already stopped. However, in reality,
  it may be that only the monitor running on a different CPU was stalled.

  This patch attempts to fix that behavior by tracking on a per-CPU basis
  whether a PM desires to run and whether it is "stalled". This lets the
  code make better decisions about when to stop PMs and when to try to
  restart them. Ideally, we should avoid the case where the code fails
  to stop a PM during a context switch out.

MFC r290813:
  Optimizations to the way hwpmc gathers user callchains

  Changes to the code to gather user stacks:
  * Delay setting pmc_cpumask until we actually have the stack.
  * When recording user stack traces, only walk the portion of the ring
    that should have samples for us.

MFC r290929:
  Change the driver stats to what they really are: unsigned values.

  When pmcstat exits after some samples were dropped, give the user an
  idea of how many were lost. (Granted, these are global numbers, but
  they may still help quantify the scope of the loss.)

MFC r290930:
  Improve accuracy of PMC sampling frequency

  The code tracks a counter which is the number of events until the next
  sample. On context switch in, it loads the saved counter. On context
  switch out, it tries to calculate a new saved counter.

  Problems:

  1. The saved counter was shared by all threads in a process. However, this
  means that all threads would be initially loaded with the same saved
  counter. However, that could result in sampling more often than once every
  X number of events.

  2. The calculation to determine a new saved counter was backwards. It
  added when it should have subtracted, and subtracted when it should have
  added. Assume a single-threaded process with a reload count of 1000
  events. Assuming the counter on context switch in was 100 and the counter
  on context switch out was 50 (meaning the thread has "consumed" 50 more
  events), the code would calculate a new saved counter of 150 (instead of
  the proper 50).

  Fix:

  1. As soon as the saved counter is used to initialize a monitor for a
  thread on context switch in, set the saved counter to the reload count.
  That way, subsequent threads to use the saved counter will get the full
  reload count, assuring we sample at least once every X number of events
  (across all threads).

  2. Change the calculation of the saved counter. Due to the change to the
  saved counter in #1, we simply need to add (modulo the reload count) the
  remaining counter time we retrieve from the CPU when a thread is context
  switched out.

MFC r291016:
  Support a wider history counter in pmcstat(8) gmon output

  pmcstat(8) contains an option to output sampling data in a gmon format
  compatible with gprof(1). Currently, it uses the default histcounter,
  which is an (unsigned short). With large sets of sampling data, it
  is possible to overflow the maximum value provided by an (unsigned
  short).

  This change adds the -e argument to pmcstat. If -e and -g are both
  specified, pmcstat will use a histcounter type of uint64_t.

MFC r291017:
  Fix the date on the pmcstat(8) man page from r291016.
2016-01-14 22:02:21 +00:00
..
libpmc.c MFC of r277177 and r279894 with the fixes for the PMC for Haswell. 2015-03-24 20:00:11 +00:00
libpmcinternal.h - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core Solo 2008-11-27 09:00:47 +00:00
Makefile MFC r263446 2014-05-31 00:40:13 +00:00
pmc_allocate.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_attach.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_capabilities.3 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
pmc_configure_logfile.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_disable.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_event_names_of_class.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_get_driver_stats.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_get_msr.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_init.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_name_of_capability.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_read.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_set.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc_start.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmc.3 mdoc: minor Bl improvements. 2012-06-02 08:47:26 +00:00
pmc.atom.3 MFC r263446 2014-05-31 00:40:13 +00:00
pmc.atomsilvermont.3 MFC r263446 2014-05-31 00:40:13 +00:00
pmc.core2.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.core.3 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
pmc.corei7.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.corei7uc.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.h MFC r290811: 2016-01-14 22:02:21 +00:00
pmc.haswell.3 Remove EOL whitespace. 2013-03-29 08:32:49 +00:00
pmc.haswelluc.3 Remove EOL whitespace. 2013-03-29 08:32:49 +00:00
pmc.iaf.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.ivybridge.3 Update hwpmc to support the Xeon class of Ivybridge processors. 2013-01-31 22:09:53 +00:00
pmc.ivybridgexeon.3 Update hwpmc to support the Xeon class of Ivybridge processors. 2013-01-31 22:09:53 +00:00
pmc.k7.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.k8.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.mips24k.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.octeon.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.p4.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.p5.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.p6.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.sandybridge.3 Update hwpmc to support the Xeon class of Ivybridge processors. 2013-01-31 22:09:53 +00:00
pmc.sandybridgeuc.3 Update man page crossreferences to sandybridge xeon class 2012-10-19 17:21:10 +00:00
pmc.sandybridgexeon.3 Add missing space 2013-03-27 07:11:29 +00:00
pmc.soft.3 Add support for good old 8192Hz profiling clock to software PMC. 2013-02-26 18:13:42 +00:00
pmc.tsc.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.ucf.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.westmere.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.westmereuc.3 Add software PMC support. 2012-03-28 20:58:30 +00:00
pmc.xscale.3 Remove trailing whitespace per mdoc lint warning 2012-03-29 05:02:12 +00:00
pmclog.3 Switch the license boilerplates to our standard one. 2012-02-17 11:09:51 +00:00
pmclog.c Add software PMC support. 2012-03-28 20:58:30 +00:00
pmclog.h Add software PMC support. 2012-03-28 20:58:30 +00:00