lkml.org 
[lkml]   [2009]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/6] tracing, page-allocator: Add a postprocessing script for page-allocator-related ftrace events
On Fri, 7 Aug 2009, Li, Ming Chun wrote:

> On Fri, 7 Aug 2009, Mel Gorman wrote:
>
> > +sub generate_traceevent_regex {
> > + my $event = shift;
> > + my $default = shift;
> > + my @fields = @_;
> > + my $regex;
>
> You are using shift to retrieve parameters below, @fields is not used
> anywhere.
>
> > +
> > + # Read the event format or use the default
> > + if (!open (FORMAT, "/sys/kernel/debug/tracing/events/$event/format")) {
> > + $regex = $default;
> > + } else {
> > + my $line;
> > + while (!eof(FORMAT)) {
> > + $line = <FORMAT>;
> > + if ($line =~ /^print fmt:\s"(.*)",.*/) {
> > + $regex = $1;
> > + $regex =~ s/%p/\([0-9a-f]*\)/g;
> > + $regex =~ s/%d/\([-0-9]*\)/g;
> > + $regex =~ s/%lu/\([0-9]*\)/g;
> > + }
> > + }
> > + }
> > +
> > + # Verify fields are in the right order
> > + my $tuple;
> > + foreach $tuple (split /\s/, $regex) {
> > + my ($key, $value) = split(/=/, $tuple);
> > + my $expected = shift;
> > + if ($key ne $expected) {
> > + print("WARNING: Format not as expected '$key' != '$expected'");
> > + $regex =~ s/$key=\((.*)\)/$key=$1/;
> > + }
> > + }
> > + if (defined $_) {
> > + die("Fewer fields than expected in format");
> > + }
> > +
>
> How about:
> if (defined shift) {
> die("Fewer fields than expected in format");
> }
> ?
>
> I don't know, just ask if it is clear.

Ah, I think it should be:
if (@_) {
die("Fewer fields than expected in format");
}

? Sorry for the noise :)

>
> > + return $regex;
> > +}
>
>

Vincent Li
Biomedical Research Center
University of British Columbia


\
 
 \ /
  Last update: 2009-08-07 21:13    [W:0.049 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site