title: How to start and stop perf sampling
body: <p>I am sampling the performance of my program with perf.</p>
  
  <p>This works for me:</p>
  
  <pre><code>$ perf record -g  ./bench
  ...
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.023 MB perf.data (93 samples) ]
  $ ls -al perf.data
  -rw------- 1 bram bram 26848 Oct 25 10:22 perf.data
  </code></pre>
  
  <p>But now I want to start and stop the collection at specific points in my program. Yet if I do:</p>
  
  <pre><code>$ perf record -g -e cycles --filter="start render_image" ./bench
  --filter option should follow a -e tracepoint option
  </code></pre>
  
  <p>I'm stumped, because the filter flag does follow the -e option. What's going on here?</p>
  
  <p>I am also puzzled by the small size of perf.data, is it really only 93 samples collected? It ran for a few seconds.</p>
  
  <p>Lastly, I am assuming that '-e cycles' is the default event?</p>
  
  <p>UPDATE: As explained by Arnabjyoti Kalita, there is a special category of events call Tracepoints. They only show up in 'perf list' for me, if I run perf as root.</p>
  
  <p>Too bad perf seems to be able to start/stop collection only if you trace that type of event, and not the default cpu cycles.</p>