7histogram.tcl at [22d13169f3]

Login

File tip/7histogram.tcl artifact 8002dd2590 part of check-in 22d13169f3


# Generator Script For Time Histogram Trace
set data {
5	4836539	10000000
6	4810808	5163461
7	345472	352653
8	1655	7181
9	364	5526
10	171	5162
11	622	4991
12	417	4369
13	123	3952
14	63	3829
15	50	3766
16	58	3716
17	80	3658
18	92	3578
19	98	3486
20	122	3388
21	160	3266
22	98	3106
23	61	3008
24	44	2947
25	56	2903
26	34	2847
27	56	2813
28	45	2757
29	61	2712
30	96	2651
31	124	2555
32	73	2431
33	60	2358
34	52	2298
35	26	2246
36	23	2220
37	38	2197
38	62	2159
39	119	2097
40	176	1978
41	160	1802
42	268	1642
43	121	1374
44	76	1253
45	31	1177
46	27	1146
47	22	1119
48	12	1097
49	12	1085
50	12	1073
51	24	1061
52	25	1037
53	39	1012
54	40	973
55	42	933
56	36	891
57	53	855
58	29	802
59	35	773
60	26	738
61	19	712
62	11	693
63	15	682
64	15	667
65	9	652
66	11	643
67	11	632
68	5	621
69	4	616
70	8	612
71	4	604
72	11	600
73	11	589
74	8	578
75	4	570
76	4	566
77	5	562
78	12	557
79	15	545
80	6	530
81	14	524
82	2	510
83	12	508
84	6	496
85	6	490
86	4	484
87	5	480
88	4	475
89	5	471
90	7	466
91	7	459
92	6	452
93	4	446
94	2	442
95	3	440
96	4	437
97	3	433
98	5	430
99	4	425
100	2	421
101	1	419
102	1	418
103	4	417
104	3	413
105	1	410
106	4	409
107	1	405
108	1	404
109	4	403
110	5	399
111	5	394
112	5	389
113	2	384
114	4	382
115	3	378
116	1	375
117	2	374
118	4	372
119	2	368
120	5	366
121	6	361
122	15	355
123	7	340
124	9	333
125	6	324
126	6	318
127	3	312
128	1	309
129	2	308
130	3	306
132	1	303
133	2	302
134	1	300
135	1	299
136	2	298
137	1	296
138	2	295
139	1	293
140	2	292
144	2	290
147	1	288
149	1	287
152	1	286
153	1	285
154	3	284
158	1	281
162	1	280
166	1	279
180	2	278
183	1	276
185	2	275
187	2	273
188	1	271
192	1	270
196	1	269
199	1	268
214	1	267
216	1	266
221	1	265
223	1	264
227	2	263
229	1	261
231	1	260
233	1	259
234	2	258
235	2	256
236	1	254
237	1	253
239	1	252
250	1	251
254	1	250
263	1	249
267	1	248
271	1	247
272	1	246
273	1	245
276	2	244
281	3	242
284	1	239
285	1	238
286	1	237
289	1	236
291	1	235
292	1	234
296	1	233
297	1	232
299	2	231
300	4	229
305	1	225
308	1	224
313	1	223
324	1	222
329	2	221
330	1	219
332	1	218
336	1	217
338	1	216
339	1	215
344	1	214
348	1	213
349	1	212
350	1	211
364	1	210
371	1	209
372	1	208
374	2	207
380	1	205
389	1	204
394	1	203
403	1	202
404	1	201
405	1	200
411	1	199
421	1	198
428	1	197
435	1	196
436	1	195
443	1	194
447	1	193
453	2	192
458	1	190
462	1	189
467	2	188
468	1	186
479	2	185
492	1	183
496	1	182
507	2	181
508	1	179
510	1	178
520	1	177
535	1	176
542	1	175
555	1	174
566	1	173
569	1	172
581	1	171
613	1	170
668	2	169
743	1	167
907	1	166
1094	1	165
1100	1	164
1136	1	163
1142	1	162
1167	1	161
1174	1	160
1176	1	159
1183	1	158
1234	1	157
1243	1	156
1358	1	155
1457	1	154
1500	1	153
1520	1	152
1535	1	151
1568	1	150
1574	1	149
1579	1	148
1583	1	147
1600	1	146
1601	1	145
1608	1	144
1610	1	143
1614	1	142
1617	1	141
1621	1	140
1627	1	139
1629	1	138
1633	1	137
1636	1	136
1641	1	135
1650	1	134
1654	1	133
1682	2	132
1688	1	130
1692	1	129
1693	1	128
1699	1	127
1700	3	126
1702	1	123
1713	1	122
1720	2	121
1722	1	119
1725	1	118
1726	2	117
1739	1	115
1749	1	114
1768	1	113
1790	1	112
1843	1	111
1850	1	110
1862	1	109
1872	1	108
1878	2	107
1907	1	105
1910	1	104
1924	1	103
1925	1	102
1927	1	101
1934	1	100
1954	1	99
2027	1	98
2031	1	97
2041	1	96
2056	1	95
2059	2	94
2061	1	92
2081	1	91
2087	1	90
2092	1	89
2095	1	88
2099	2	87
2110	1	85
2117	2	84
2127	1	82
2139	1	81
2153	1	80
2163	1	79
2179	1	78
2180	1	77
2197	1	76
2201	1	75
2220	1	74
2222	1	73
2229	1	72
2245	1	71
2248	1	70
2252	1	69
2273	2	68
2298	1	66
2303	1	65
2343	1	64
2347	1	63
2357	1	62
2388	1	61
4150	1	60
4272	1	59
4308	1	58
4324	1	57
5146	1	56
5151	1	55
5156	1	54
5161	1	53
5162	1	52
5164	1	51
5165	1	50
5166	1	49
5167	2	48
5170	1	46
5172	1	45
5173	2	44
5185	1	42
5192	1	41
5194	2	40
5306	1	38
5323	1	37
5327	1	36
5348	1	35
5353	1	34
5361	1	33
5362	1	32
5364	1	31
5377	1	30
5458	1	29
5540	1	28
5632	1	27
5635	1	26
6780	1	25
6797	1	24
6922	1	23
6944	1	22
6972	1	21
7083	1	20
7084	1	19
7085	1	18
7092	1	17
7102	1	16
7150	1	15
7153	1	14
7175	1	13
7189	1	12
7217	1	11
7224	1	10
7233	1	9
7240	1	8
7274	1	7
7297	1	6
7306	1	5
7334	1	4
7379	1	3
7625	1	2
7697	1	1
}

grid [canvas .c -width 640 -height 480 -bg white]
.c create text 320 5 \
    -font {Helvetica 12} \
    -text {Histogram of time reported by [time {}]} \
    -anchor n \
    -tags title
foreach { - - - ytop } [.c bbox title] {}
set ybot 440
set ymid [expr { ( $ytop + $ybot ) / 2 }]
set yscale [expr { ( $ytop - $ybot ) / 8 }]
.c create text 5 $ymid -text {Count} -font {Helvetica 10} -anchor w \
    -tags ylabel
foreach { - - x1 - } [.c bbox ylabel] {}
for { set n 0 } { $n <= 7 } { incr n } {
    set y [expr { $yscale * ( $n + 0.5 ) + $ybot }]
    set item [.c create text $x1 $y -text 10 -font {Helvetica 10} -anchor w \
		  -tags ymark]
    foreach { - y2 x2 - } [.c bbox $item] {}
    set item [.c create text $x2 $y2 -text $n -font {Helvetica 8} \
		  -anchor w -tags ymark]
    foreach { - - x3 - } [.c bbox $item] {}
    if { $n < 7 } {
	set l 9
    } else {
	set l 1
    }
    for { set t 1 } { $t <= $l } { incr t } {
	set dy [expr { $yscale * ( log($t) / log (10) ) }]
	.c create line $x3 [expr { $y+$dy }] \
	    [expr { $x3+5 }] [expr { $y+$dy }] -tags ytic
    }
}
foreach { - - xleft - } [.c bbox ymark] {}
.c create line $xleft $ybot $xleft $ytop -tags yaxis
set xright 620
set xscale [expr { ( $xright - $xleft) / 4 }]
set xmid [expr { ( $xright + $xleft ) / 2 }]
.c create text $xmid 470 -text {Time (seconds)} \
    -font {Helvetica 10} -tags xlabel
foreach { - y1 - - } [.c bbox xlabel] {}
for { set n -6 } { $n <= -2 } { incr n } {
    set x [expr { $xscale * ( $n + 6 ) + $xleft }]
    set item [.c create text $x $y1 -anchor se -text 10 -font {Helvetica 10} \
		  -tags xmark]
    foreach { - y2 x2 - } [.c bbox $item] {}
    .c create text $x2 $y2 -text $n -font {Helvetica 8} -text $n \
	-anchor w -tags xmark
    if { $n < -2 } {
	set l 9
    } else {
	set l 1
    }
    for { set t 1 } { $t <= $l } { incr t } {
	set dx [expr { $xscale * ( log($t) / log (10) ) }]
	.c create line [expr {$x + $dx}] $ybot \
	    [expr { $x+$dx }] [expr { $ybot-5 }] -tags xtic
    }
}
.c create line $xleft $ybot $xright $ybot -tags xaxis
foreach { t count cum } $data {
    set x [expr { $xscale * ( log($t) / log(10) ) + $xleft }]
    set y1 [expr { $yscale * ( log($count) / log(10) + 0.5 ) + $ybot }]
    .c create line [expr $x-1] $y1 $x [expr $y1-1] \
	[expr $x+1] $y1 $x [expr $y1+1] [expr $x-1] $y1
    set y2 [expr { $yscale * ( log($cum) / log(10) + 0.5 ) + $ybot }]
    lappend clist $x $y2
}
eval [list .c create line] $clist [list -fill red] -tags cum
.c lower cum
.c create line 320 50 350 50 -fill red
.c create text 355 50 -anchor w -text {Cumulative count} -font {Helvetica 10}
.c create line 335 64 334 65 335 66 336 65 335 64
.c create text 355 64 -anchor w -text {Individual bins} -font {Helvetica 10}