[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7d416932-12a0-8130-354a-f0a9898d9bf6@huawei.com>
Date: Mon, 11 May 2020 15:52:02 +0100
From: John Garry <john.garry@...wei.com>
To: Jiri Olsa <jolsa@...hat.com>
CC: <peterz@...radead.org>, <mingo@...hat.com>, <acme@...nel.org>,
<mark.rutland@....com>, <alexander.shishkin@...ux.intel.com>,
<namhyung@...nel.org>, <will@...nel.org>, <ak@...ux.intel.com>,
<linuxarm@...wei.com>, <linux-kernel@...r.kernel.org>,
<qiangqing.zhang@....com>, <irogers@...gle.com>,
<robin.murphy@....com>, <zhangshaokun@...ilicon.com>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH RFC v3 02/12] perf jevents: Add support for system events
tables
On 11/05/2020 12:01, Jiri Olsa wrote:
> On Thu, May 07, 2020 at 07:57:41PM +0800, John Garry wrote:
>
> SNIP
>
>>
>> +static bool is_sys_dir(char *fname)
>> +{
>> + char *pos;
>> +
>> + while (true) {
>> + pos = strchr(fname, '/');
>
> would strrchr be faster?
maybe, I'll check the logic here to see if it can be reduced
also I thought there's something like
> basename function that could be usable in here?
it's tricky, as we support putting JSONs in ./, or ./sys, or ./cpu
But I'll revisit this, as I cannot understand the logic at a glance,
which is not good...
Thanks,
John
>
> jirka
>
>> +
>> + if (!pos) {
>> + if (!strcmp(fname, "sys"))
>> + return true;
>> + return false;
>> + }
>> +
>> + fname = pos + 1;
>> + }
>> +
>> + return false;
>> +}
>
> .
>
Powered by blists - more mailing lists