Messages in this thread | | | Subject | Re: [PATCH] [RFCv3] perf: robustify proc and debugfs file recording | From | Peter Zijlstra <> | Date | Thu, 14 Jul 2011 14:55:30 +0200 |
| |
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..
| |