1 { 2 # 3 # Copyright 2005 Sun Microsystems, Inc. All rights reserved. 4 # Use is subject to license terms. 5 # 6 # CDDL HEADER START 7 # 8 # The contents of this file are subject to the terms of the 9 # Common Development and Distribution License, Version 1.0 only 10 # (the "License"). You may not use this file except in compliance 11 # with the License. 12 # 13 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 14 # or http://www.opensolaris.org/os/licensing. 15 # See the License for the specific language governing permissions 16 # and limitations under the License. 17 # 18 # When distributing Covered Code, include this CDDL HEADER in each 19 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 20 # If applicable, add the following below this CDDL HEADER, with the 21 # fields enclosed by brackets "[]" replaced with your own identifying 22 # information: Portions Copyright [yyyy] [name of copyright owner] 23 # 24 # CDDL HEADER END 25 # 26 #ident "%Z%%M% %I% %E% SMI" 27 28 if (first_time == 0 && ($1 == "probe" || match($1, "---"))) 29 next; 30 else 31 first_time = 1; 32 33 time = $1; 34 thread = $5; 35 type = $7; 36 val = pval = ""; 37 for (i = 8; i <= NF; i++) { 38 if (pval == "cip:") 39 val = val " " sprintf("%x", $i); 40 else 41 val = val " " $i; 42 pval=$i 43 } 44 45 if (match(type, "_end")) { 46 type = substr(type, 1, match(type, "_end") - 1); 47 48 if (int(start[thread "" type]) == 0) { 49 printf("Warning: missing match line %d: %s\n", NR, $0); 50 next; 51 } 52 53 total[type]++; 54 alltotal++; 55 56 elapsed = time - start[thread "" type]; 57 vchar = ""; 58 if (longest[type] < elapsed) { 59 longest[type] = elapsed; 60 vchar = "*"; 61 } 62 if (verbose) { 63 printf("\t\top: %s thread: %d elapsed %f%s%s\n", 64 type, thread, elapsed, val, vchar); 65 } 66 average[type] = (average[type] + elapsed)/total[type]; 67 averagedepth[type] = (averagedepth[type] + depth[type])/total[type]; 68 69 allaverage= (allaverage + alldepth)/alltotal; 70 71 depth[type]--; 72 alldepth--; 73 start[thread "" type] = 0; 74 75 } else { 76 if (match(type, "_start")) { 77 type = substr(type, 1, match(type, "_start") - 1); 78 } 79 start[thread "" type] = time; 80 depth[type]++; 81 if (maxdepth[type] < depth[type]) 82 maxdepth[type] = depth[type]; 83 84 alldepth++; 85 if (allmaxdepth < alldepth) 86 allmaxdepth = alldepth; 87 } 88 } 89 90 END { 91 printf("\n"); 92 for (types in total) { 93 printf("op: %d %s: avg: %8.8f worst: %8.8f\n", 94 total[types], types, average[types], longest[types]); 95 printf(" avg concurrency: %8.8f greatest concurrency %8.8f\n\n", 96 averagedepth[types], maxdepth[types]); 97 } 98 printf("Totals: avg concurrency: %8.8f greatest concurrency %8.8f\n", 99 allaverage, allmaxdepth); 100 }