jdk/test/sun/tools/jcmd/jcmd_pid_Output2.awk
author fparain
Wed, 04 Jan 2012 03:49:35 -0800
changeset 11365 05d995976571
permissions -rw-r--r--
7104647: Adding a diagnostic command framework Reviewed-by: mchung, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11365
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     1
#
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     2
BEGIN	{
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     3
	    totallines=0; matched=0
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     4
	}
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     5
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     6
# match on counter name followed '=' and an arbitrary value
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     7
/^[a-z|A-Z][a-z|A-Z|0-9|\.|_]*=.*$/	{
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     8
	    matched++;
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
     9
	}
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    10
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    11
# or match the first line (PID of the JVM followed by ':')
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    12
/^[0-9]+:/	{
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    13
	    matched++;
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    14
	}
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    15
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    16
	{ totallines++; print $0 }
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    17
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    18
END	{
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    19
    if ((totallines > 0) && (matched == totallines)) {
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    20
	exit 0
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    21
    }
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    22
    else {
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    23
	exit 1
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    24
    }
05d995976571 7104647: Adding a diagnostic command framework
fparain
parents:
diff changeset
    25
}