lkml.org 
[lkml]   [2011]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] [RFCv3] perf: robustify proc and debugfs file recording
From
Date
On Thu, 2011-07-14 at 08:45 -0400, Steven Rostedt wrote:
> ---
> tools/perf/util/trace-event-info.c | 120 ++++++++------------------------=
> -----
> 1 file changed, 29 insertions(+), 91 deletions(-)
>
> Index: linux-ozlabs/tools/perf/util/trace-event-info.c
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-ozlabs.orig/tools/perf/util/trace-event-info.c 2011-07-13 20:42:2=
> 4.442945973 +1000
> +++ linux-ozlabs/tools/perf/util/trace-event-info.c 2011-07-14 10:14:19.072=
> 946058 +1000
> @@ -183,106 +183,59 @@
> return *ptr =3D=3D 0x01020304;
> }
> =20
> -static unsigned long long copy_file_fd(int fd)
> +/* unfortunately, you can not stat debugfs or proc files for size */
> +static void record_file(const char *file, size_t hdr_sz)
> {
> unsigned long long size =3D 0;

Yeah, its all the rage, we're supposed to write full RFC compliant email
parsers these days :(

/Content-Transfer-Encoding:.*quoted-printable.*/ {
decode = 1;
}

// {
tmp = $0

if (!decode) {
print tmp
next
}

if (concat) {
tmp = last tmp
concat = 0;
}

if (tmp ~ /=$/) {
concat = 1;
gsub("=$", "", tmp);
}

offset = 0;
while (match(tmp, /=[[:xdigit:]][[:xdigit:]]/, a)) {
if (a[0] < offset)
break;
hex = substr(a[0], 2)
char = sprintf("%c", strtonum("0x"hex))
gsub(a[0], char, tmp)
offset = a[0];
}

if (concat) {
last = tmp
next
}

print tmp
}


Should decode that crap I think..


\
 
 \ /
  Last update: 2011-07-14 14:59    [W:0.126 / U:0.816 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site