lkml.org 
[lkml]   [2014]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] perf: Allow ability to map cpus to nodes easily
On Mon, Apr 07, 2014 at 02:28:35PM +0900, Namhyung Kim wrote:
> On Sun, 6 Apr 2014 14:15:46 +0200, Jiri Olsa wrote:
> > On Thu, Apr 03, 2014 at 02:48:51PM +0900, Namhyung Kim wrote:
> >> More generally, this sysfs access needs to check actual mountpoint using
> >> sysfs__mountpoint() IMHO.
> >>
> >> Also this API can be generalized like reading int value from a sysfs
> >> file as the filename itself represents the content in most cases.
> >>
> >> So how about changing this way? It might reside on somewhere in tools/lib/api/fs/.
> >>
> >> max_cpu_num = sysfs__read_int("devices/system/cpu/possible");
> >>
> >> max_node_num = sysfs__read_int("devices/system/node/possible");
> >>
> >>
> >> Hmm.. looking at the code, perf already has filename__read_{int,str} API
> >> in util/util.c. Maybe you can just use it instead.
> >
> > I think those just read the file, while Don needs to parse
> > the map to get max cpu number
>
> Ah, missed that... sorry for noise.

Well, I already implemented using filename__read_str. It is just added
overhead, but the end result is the same, a string needs to be read from
the file. I just had to remember to free the memory at the end of the
function.

Cheers,
Don


\
 
 \ /
  Last update: 2014-04-07 21:01    [W:0.030 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site