()
| 148 | |
| 149 | |
| 150 | def main(): |
| 151 | parser = ArgumentParser(description="Process GCTracer's NVP output") |
| 152 | parser.add_argument('keys', metavar='KEY', type=str, nargs='+', |
| 153 | help='the keys of NVPs to process') |
| 154 | parser.add_argument('--histogram-type', metavar='<linear|log2>', |
| 155 | type=str, nargs='?', default="linear", |
| 156 | help='histogram type to use (default: linear)') |
| 157 | linear_group = parser.add_argument_group('linear histogram specific') |
| 158 | linear_group.add_argument('--linear-histogram-granularity', |
| 159 | metavar='GRANULARITY', type=int, nargs='?', |
| 160 | default=5, |
| 161 | help='histogram granularity (default: 5)') |
| 162 | log2_group = parser.add_argument_group('log2 histogram specific') |
| 163 | log2_group.add_argument('--log2-histogram-init-bucket', metavar='START', |
| 164 | type=int, nargs='?', default=64, |
| 165 | help='initial buck size (default: 64)') |
| 166 | parser.add_argument('--histogram-omit-empty-buckets', |
| 167 | dest='histogram_omit_empty', |
| 168 | action='store_true', |
| 169 | help='omit empty histogram buckets') |
| 170 | parser.add_argument('--no-histogram', dest='histogram', |
| 171 | action='store_false', help='do not print histogram') |
| 172 | parser.set_defaults(histogram=True) |
| 173 | parser.set_defaults(histogram_omit_empty=False) |
| 174 | parser.add_argument('--rank', metavar='<no|min|max|avg>', |
| 175 | type=str, nargs='?', |
| 176 | default="no", |
| 177 | help="rank keys by metric (default: no)") |
| 178 | parser.add_argument('--csv', dest='csv', |
| 179 | action='store_true', help='provide output as csv') |
| 180 | parser.add_argument('--percentiles', dest='percentiles', |
| 181 | type=str, default="", |
| 182 | help='comma separated list of percentiles') |
| 183 | args = parser.parse_args() |
| 184 | |
| 185 | histogram = None |
| 186 | if args.histogram: |
| 187 | bucket_trait = None |
| 188 | if args.histogram_type == "log2": |
| 189 | bucket_trait = Log2Bucket(args.log2_histogram_init_bucket) |
| 190 | else: |
| 191 | bucket_trait = LinearBucket(args.linear_histogram_granularity) |
| 192 | histogram = Histogram(bucket_trait, not args.histogram_omit_empty) |
| 193 | |
| 194 | percentiles = [] |
| 195 | for percentile in args.percentiles.split(','): |
| 196 | try: |
| 197 | percentiles.append(float(percentile)) |
| 198 | except ValueError: |
| 199 | pass |
| 200 | |
| 201 | categories = [ Category(key, deepcopy(histogram), args.csv, percentiles) |
| 202 | for key in args.keys ] |
| 203 | |
| 204 | while True: |
| 205 | line = stdin.readline() |
| 206 | if not line: |
| 207 | break |
no test coverage detected