lkml.org 
[lkml]   [2016]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v13 5/8] perf record: Read from overwritable ring buffer
On Mon, Jul 04, 2016 at 06:20:06AM +0000, Wang Nan wrote:

SNIP

> +static void
> +record__toggle_overwrite_evsels(struct record *rec,
> + enum overwrite_evt_state state)
> +{
> + struct perf_evlist *evlist = rec->overwrite_evlist;
> + enum overwrite_evt_state old_state = rec->overwrite_evt_state;
> + enum action {
> + NONE,
> + PAUSE,
> + RESUME,
> + } action = NONE;
> +
> + switch (old_state) {
> + case OVERWRITE_EVT_RUNNING: {
> + switch (state) {
> + case OVERWRITE_EVT_DATA_PENDING:
> + action = PAUSE;
> + break;
> + case OVERWRITE_EVT_RUNNING:
> + case OVERWRITE_EVT_EMPTY:
> + default:
> + goto state_err;
> + }
> + break;
> + }
> + case OVERWRITE_EVT_DATA_PENDING: {
> + switch (state) {
> + case OVERWRITE_EVT_EMPTY:
> + break;
> + case OVERWRITE_EVT_RUNNING:
> + case OVERWRITE_EVT_DATA_PENDING:
> + default:
> + goto state_err;
> + }
> + break;
> + }
> + case OVERWRITE_EVT_EMPTY: {
> + switch (state) {
> + case OVERWRITE_EVT_RUNNING:
> + action = RESUME;
> + break;
> + case OVERWRITE_EVT_EMPTY:
> + case OVERWRITE_EVT_DATA_PENDING:
> + default:
> + goto state_err;
> + }
> + break;
> + }
> + default:
> + WARN_ONCE(1, "Shouldn't get there\n");
> + }
> +
> + rec->overwrite_evt_state = state;
> +
> + if (!evlist)
> + return;

I'd expect this check at the begining

jirka

\
 
 \ /
  Last update: 2016-07-06 14:21    [W:0.148 / U:1.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site