)]}'
{
  "commit": "3df33eff2ba96be4f1535db4f672013d756dc9b1",
  "tree": "2541787adfa3a98375ce43c69decc16d84935050",
  "parents": [
    "cb3f3378cd09aa3fe975b4ad5ee0229dc76315bb"
  ],
  "author": {
    "name": "Mark Rutland",
    "email": "mark.rutland@arm.com",
    "time": "Tue Aug 09 14:04:29 2016 +0100"
  },
  "committer": {
    "name": "Arnaldo Carvalho de Melo",
    "email": "acme@redhat.com",
    "time": "Tue Aug 09 10:48:32 2016 -0300"
  },
  "message": "perf stat: Avoid skew when reading events\n\nWhen we don\u0027t have a tracee (i.e. we\u0027re attaching to a task or CPU),\ncounters can still be running after our workload finishes, and can still\nbe running as we read their values. As we read events one-by-one, there\ncan be arbitrary skew between values of events, even within a group.\nThis means that ratios within an event group are not reliable.\n\nThis skew can be seen if measuring a group of identical events, e.g:\n\n  # perf stat -a -C0 -e \u0027{cycles,cycles}\u0027 sleep 1\n\nTo avoid this, we must stop groups from counting before we read the\nvalues of any constituent events. This patch adds and makes use of a new\ndisable_counters() helper, which disables group leaders (and thus each\ngroup as a whole). This mirrors the use of enable_counters() for\nstarting event groups in the absence of a tracee.\n\nClosing a group leader splits the group, and without a disabled group\nleader the newly split events will begin counting. Thus to ensure counts\nare reliable we must defer closing group leaders until all counts have\nbeen read. To do so this patch removes the event closing logic from the\nread_counters() helper, explicitly closes the events using\nperf_evlist__close(), which also aids legibility.\n\nSigned-off-by: Mark Rutland \u003cmark.rutland@arm.com\u003e\nTested-by: Arnaldo Carvalho de Melo \u003cacme@redhat.com\u003e\nCc: Alexander Shishkin \u003calexander.shishkin@linux.intel.com\u003e\nCc: Peter Zijlstra \u003cpeterz@infradead.org\u003e\nLink: http://lkml.kernel.org/r/1470747869-3567-1-git-send-email-mark.rutland@arm.com\nSigned-off-by: Arnaldo Carvalho de Melo \u003cacme@redhat.com\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0c16d20d7e32fa2eb7377247c2e5542d2a5d076a",
      "old_mode": 33188,
      "old_path": "tools/perf/builtin-stat.c",
      "new_id": "3c7452b39f57649b05d675db3d19395fb765df2d",
      "new_mode": 33188,
      "new_path": "tools/perf/builtin-stat.c"
    }
  ]
}
