| 1 |
# |
| 2 |
# Amanda, The Advanced Maryland Automatic Network Disk Archiver |
| 3 |
# Copyright (c) 1992-1998, 2000 University of Maryland at College Park |
| 4 |
# Copyright (c) 2007-2012 Zmanda, Inc. All Rights Reserved. |
| 5 |
# Copyright (c) 2013-2016 Carbonite, Inc. All Rights Reserved. |
| 6 |
# All Rights Reserved. |
| 7 |
# |
| 8 |
# Permission to use, copy, modify, distribute, and sell this software and its |
| 9 |
# documentation for any purpose is hereby granted without fee, provided that |
| 10 |
# the above copyright notice appear in all copies and that both that |
| 11 |
# copyright notice and this permission notice appear in supporting |
| 12 |
# documentation, and that the name of U.M. not be used in advertising or |
| 13 |
# publicity pertaining to distribution of the software without specific, |
| 14 |
# written prior permission. U.M. makes no representations about the |
| 15 |
# suitability of this software for any purpose. It is provided "as is" |
| 16 |
# without express or implied warranty. |
| 17 |
# |
| 18 |
# U.M. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL |
| 19 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL U.M. |
| 20 |
# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 21 |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION |
| 22 |
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN |
| 23 |
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 24 |
# |
| 25 |
# Author: Olafur Gudumundsson, [email protected] |
| 26 |
# formerly at: Systems Design and Analysis Group |
| 27 |
# Computer Science Department |
| 28 |
# University of Maryland at College Park |
| 29 |
# |
| 30 |
# An awk program to parse the amdump file and output the information |
| 31 |
# in a form at the gnuplot program amplot.g wants |
| 32 |
# |
| 33 |
# Creation Date: April 1992 |
| 34 |
# modified: Aug 1993 |
| 35 |
# Modified for Amanda-2.2: Dec 1993 |
| 36 |
# Modified for Amanda-2.2: Mar 1994 and May 1994 and June 1994 |
| 37 |
# Enhanced: April 1995 |
| 38 |
# Input: One amdump file |
| 39 |
# Output: Number of files that get fed into gnuplot |
| 40 |
# |
| 41 |
BEGIN{ |
| 42 |
# The folowing parameters may have to be set to suit each site, both |
| 43 |
# parameters are expressed in HOUR's. |
| 44 |
# If your average amanda dump is more than 3 hours you should increase the |
| 45 |
# value of maxtime, similary if your dumps are finishing in less than 2 hours |
| 46 |
# you should decrease the value of maxtime. |
| 47 |
# This is now setable from amplot's command line. |
| 48 |
# maxtime = 4; # how long to plot graph for in hours |
| 49 |
|
| 50 |
# Min host controls the reporting of hosts that take long in dumping |
| 51 |
# This varible can be set explicity or as a fraction of maxtime |
| 52 |
# If you are seeing too many hosts reported increase the value of this |
| 53 |
# constant |
| 54 |
# |
| 55 |
min_host = maxtime * 0.75; # good rule of thumb |
| 56 |
# min_host = 2.5; # expicit cutoff value in hours |
| 57 |
|
| 58 |
# |
| 59 |
# DO NOT CHANGE ANYTHING BELOW THIS LINE |
| 60 |
# |
| 61 |
time_scale = 60; # display in minutes DO NOT CHANGE |
| 62 |
maxtime *= time_scale; # convert to minutes |
| 63 |
min_host *= time_scale *time_scale; # convert to seconds |
| 64 |
# dumping than this |
| 65 |
disk_raise = 120; # scaling factors for Holding disk graph |
| 66 |
tape_raise = 90; |
| 67 |
dump_shift = 7.5; # scaling factors for Dumpers idle graph |
| 68 |
dump_raise = 0; |
| 69 |
que_raise = 300; # scaling factors for the queue's |
| 70 |
count_scale= 1.0/3.0; # new scale |
| 71 |
# scaling factors for the x axis |
| 72 |
bandw_raise = 250; |
| 73 |
bandw_scale = 30/300; # default calculated below |
| 74 |
|
| 75 |
holding_disk = -1; # uninitialized |
| 76 |
|
| 77 |
cnt = 0; # default values for counters |
| 78 |
din = 0; # number of dumps to holding disk |
| 79 |
dout = 0; # number of dumps to tape |
| 80 |
tapeq = 0; # how many dumps in tape queue |
| 81 |
tape_err = 0; # how many tape errors |
| 82 |
tout = 0; # data written out to tape |
| 83 |
quit = 0; # normal end of run |
| 84 |
plot_fmt = "%7.2f %6.2f\n%7.2f %6.2f\n"; # format of files for gnuplot |
| 85 |
plot_fmt1 = "%7.2f %6.2f\n"; # format of files for gnuplot |
| 86 |
} |
| 87 |
|
| 88 |
{ # state machine for processing input lines lines |
| 89 |
if( $1 == "driver:") { |
| 90 |
if($2=="result") do_result(); |
| 91 |
else if( $2=="state") do_state(); |
| 92 |
else if( $2=="interface-state") ; |
| 93 |
else if( $2=="hdisk-state") do_hdisk++; |
| 94 |
else if( $2=="flush" && $3=="size" ) { |
| 95 |
flush_size = $4; |
| 96 |
} |
| 97 |
else if( $2=="start" && $3=="time") do_start(); |
| 98 |
else if( $2=="send-cmd") { |
| 99 |
if( $7=="FILE-DUMP"){ |
| 100 |
file_dump++; |
| 101 |
dmpr_strt[$6]=$4; |
| 102 |
host[$6]=$10; |
| 103 |
disk[$6]=$12; |
| 104 |
level[$6]=$14; |
| 105 |
} |
| 106 |
else if( $7=="PORT-DUMP"){ |
| 107 |
file_dump++; |
| 108 |
dmpr_strt[$6]=$4; |
| 109 |
host[$6]=$12; |
| 110 |
disk[$6]=$14; |
| 111 |
level[$6]=$16; |
| 112 |
} |
| 113 |
else if( $7 == "SHM-DUMP") { |
| 114 |
file_write++; |
| 115 |
dmpr_strt[$6]=$4; |
| 116 |
host[$6]=$12; |
| 117 |
disk[$6]=$14; |
| 118 |
level[$6]=$16; |
| 119 |
} |
| 120 |
else if( $7 == "FILE-WRITE") { |
| 121 |
file_write++; |
| 122 |
dmpr_strt[$6]=$4; |
| 123 |
host[$6]=$10; |
| 124 |
disk[$6]=$12; |
| 125 |
level[$6]=$14; |
| 126 |
} |
| 127 |
else if( $7 == "SHM-WRITE") { |
| 128 |
if (match($6, /^chunker/)) { |
| 129 |
file_write++; |
| 130 |
dmpr_strt[$6]=$4; |
| 131 |
host[$6]=$10; |
| 132 |
disk[$6]=$12; |
| 133 |
level[$6]=$13; |
| 134 |
} else { # taper |
| 135 |
file_write++; |
| 136 |
dmpr_strt[$6]=$4; |
| 137 |
host[$6]=$10; |
| 138 |
disk[$6]=$11; |
| 139 |
level[$6]=$12; |
| 140 |
} |
| 141 |
} |
| 142 |
else if( $7 == "PORT-WRITE") { |
| 143 |
if (match($6, /^chunker/)) { |
| 144 |
file_write++; |
| 145 |
dmpr_strt[$6]=$4; |
| 146 |
host[$6]=$10; |
| 147 |
disk[$6]=$12; |
| 148 |
level[$6]=$13; |
| 149 |
} else { # taper |
| 150 |
file_write++; |
| 151 |
dmpr_strt[$6]=$4; |
| 152 |
host[$6]=$10; |
| 153 |
disk[$6]=$11; |
| 154 |
level[$6]=$12; |
| 155 |
} |
| 156 |
} |
| 157 |
else if( $7 == "START-TAPER") fil = $9; |
| 158 |
} |
| 159 |
else if( $2=="finished-cmd") cmd_fin++; |
| 160 |
else if( $2=="started") forked++; |
| 161 |
else if( $2=="QUITTING") do_quit(); |
| 162 |
else if( $2=="find_diskspace:") ; #eat this line |
| 163 |
else if( $2=="assign_holdingdisk:") ; #eat this line |
| 164 |
else if( $2=="adjust_diskspace:") ; #eat this line |
| 165 |
else if( $2=="tape" && $3=="size") ; #eat this line |
| 166 |
else if( $2=="dump" && $3=="failed") ; #eat this line |
| 167 |
else if( $2=="taper" && $3=="failed") ; #eat this line |
| 168 |
else if( $2=="taper" && $4=="storage") ; #eat this line |
| 169 |
else if( $2=="to" && $3=="write") ; #eat this line |
| 170 |
else if( $2=="dumping" || $2 == "adding" || $2 == "holding-disks:") |
| 171 |
dumping++; # eat this line |
| 172 |
else if( $2!="FINISHED" && $2 != "pid" && $2 != "taper-tryagain"&& $2!="startaflush:") |
| 173 |
print fil,"Unknown statement#",$0; |
| 174 |
} |
| 175 |
else if ( $1 == "planner:") { |
| 176 |
if( $2 == "SKIPPED" || $2 == "FAILED") { |
| 177 |
failed++; |
| 178 |
print fil, "INFO#", $0; |
| 179 |
} |
| 180 |
} |
| 181 |
else if( $1 == "GENERATING") sched_start=NR; |
| 182 |
else if( $1 == "ENDFLUSH") sched_start=NR; |
| 183 |
else if( $1 == "DELAYING") do_moves(); # find estimated size |
| 184 |
else if( $1 == "dumper:") { |
| 185 |
if($4 != "starting" && $2 != "pid" && $2 != "stream_client:" && $2 != "dgram_bind:") |
| 186 |
print fil, "INFO#", $0; |
| 187 |
} |
| 188 |
else if( $1 == "taper:") { |
| 189 |
if($3 != "label" && $3 != "end" && $2 != "DONE" && $2 != "pid" && $2 != "slot" && $2 != "reader-side:" && $2 != "page" && $2 != "buffer" && $3 != "at" && $3 != "switching" && $2 != "slot:" && $2 != "status") |
| 190 |
print fil, "INFO#", $0; |
| 191 |
} |
| 192 |
else if( $1 == "FLUSH") { |
| 193 |
no_flush++; |
| 194 |
} |
| 195 |
else if( NF==1 && sched_start > 0 && NR-sched_start > 1) { # new style end of schedule |
| 196 |
no_disks = NR-sched_start-2; # lets hope there are no extra lines |
| 197 |
sched_start = 0; |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
function do_state(){ # state line is printed out after driver |
| 202 |
# finishes pondering new actions |
| 203 |
# it reports the state as seen be driver |
| 204 |
# fields in the state line |
| 205 |
# $2 = "state" # $3 = "time" # $4 = time_val |
| 206 |
# $5 = "free" # $6 = "kps:" # $7 = network_free_kps |
| 207 |
# $8 = "space:" # $9 = space # $10 = "taper:" |
| 208 |
# $11 = "writing"/"idle"# $12 = "idle-dumpers:" |
| 209 |
# $13 = #idle # $14 = "qlen" |
| 210 |
# $15 = "tapeq" # $16 = "taperX:" # $17 = number:number |
| 211 |
# 15-16-17 are repeatable |
| 212 |
# $18 = "runq:" # $19 = #not started |
| 213 |
# $20 = "directq:" # $21 = #directq |
| 214 |
# $22 = "roomq" # $23 = #roomq |
| 215 |
# $24 = "wakeup:" # $25 = #wakeup |
| 216 |
# $26 = "driver-idle:" # $27 = status |
| 217 |
|
| 218 |
cnt++; # number of event |
| 219 |
time = $4/time_scale; |
| 220 |
#Check overflow in driver ouput (big value instead of negative) |
| 221 |
if($7>0 && $7 < 0x7fffffff) |
| 222 |
unused = (bandw - $7)*bandw_scale+bandw_raise; |
| 223 |
else |
| 224 |
unused = bandw_raise; |
| 225 |
if( unused != unused_old) |
| 226 |
printf plot_fmt, time, unused_old, time,unused >>"bandw_free"; |
| 227 |
unused_old = unused; |
| 228 |
|
| 229 |
if(holding_disk_old != $9) { |
| 230 |
disk_alloc_time[disk_a] = time; |
| 231 |
disk_alloc_space[disk_a] = holding_disk_old; |
| 232 |
disk_a++; |
| 233 |
disk_alloc_time[disk_a] = time; |
| 234 |
disk_alloc_space[disk_a] = $9; |
| 235 |
disk_a++; |
| 236 |
holding_disk_old = $9; |
| 237 |
} |
| 238 |
|
| 239 |
twait = tsize; |
| 240 |
if(twait_old != twait) { |
| 241 |
twait_time[twait_a] = time; |
| 242 |
twait_wait[twait_a] = twait_old; |
| 243 |
twait_a++; |
| 244 |
twait_time[twait_a] = time; |
| 245 |
twait_wait[twait_a] = twait; |
| 246 |
twait_a++; |
| 247 |
twait_old = twait; |
| 248 |
} |
| 249 |
|
| 250 |
active = (dumpers-$13)*dump_shift+dump_raise; |
| 251 |
if( active != active_old ) |
| 252 |
printf plot_fmt, time, active_old, time, active >> "dump_idle"; |
| 253 |
active_old = active; |
| 254 |
|
| 255 |
# tape on or off |
| 256 |
if($11=="writing")state = tape_raise+10; |
| 257 |
else state = tape_raise; |
| 258 |
if( state != state_old ) |
| 259 |
printf plot_fmt, time, state_old, time, state >> "tape_idle"; |
| 260 |
state_old = state; |
| 261 |
|
| 262 |
runq = 15 |
| 263 |
tapeq = 0; |
| 264 |
while ($runq == "tapeq") { |
| 265 |
xtapeq=runq+2 |
| 266 |
split($xtape1, xxtapeq, ":") |
| 267 |
tapeq += $xxtapeq[0] + xxtapeq[1] |
| 268 |
runq += 3 |
| 269 |
} |
| 270 |
|
| 271 |
runq += 1 |
| 272 |
run = $runq*count_scale+que_raise; |
| 273 |
if( run != run_old ) |
| 274 |
printf plot_fmt, time, run_old, time, run >> "run_queue"; |
| 275 |
run_old = run; |
| 276 |
|
| 277 |
finish = written * count_scale+que_raise; |
| 278 |
if( finish != finish_old ) |
| 279 |
printf plot_fmt, time, finish_old, time, finish >> "finished"; |
| 280 |
finish_old = finish; |
| 281 |
|
| 282 |
tapeQ = tapeq * count_scale+que_raise; |
| 283 |
if( tapeQ != tapeQ_old ) |
| 284 |
printf plot_fmt, time, tapeQ_old, time, tapeQ >> "tape_queue"; |
| 285 |
tapeQ_old = tapeQ; |
| 286 |
|
| 287 |
} |
| 288 |
|
| 289 |
function do_start() { # get configuration parameters |
| 290 |
dumpers = $6; # how many |
| 291 |
day = $14; |
| 292 |
dump_shift = 75/dumpers; |
| 293 |
bandw = $8; |
| 294 |
bandw_scale = (30/bandw); |
| 295 |
unused_old = bandw_raise; |
| 296 |
print 0, unused_old > "bandw_free"; |
| 297 |
if( sched_start >0 ) { |
| 298 |
no_disks = NR-sched_start-1; # backward compatability |
| 299 |
sched_start =0; |
| 300 |
print "do_start: no_disks", no_disks, $0; |
| 301 |
} |
| 302 |
no_disks += no_flush; |
| 303 |
size = $10/1024; # size of holding disk in MB |
| 304 |
holding_disk= $10 + flush_size; |
| 305 |
init_holding_disk= $10 + flush_size; |
| 306 |
holding_disk_old = $10; |
| 307 |
disk_a = 0; |
| 308 |
disk_alloc_time[disk_a] = 0; |
| 309 |
disk_alloc_space[disk_a] = holding_disk_old; |
| 310 |
disk_a++; |
| 311 |
tsize = flush_size; |
| 312 |
twait_old = tsize; |
| 313 |
twait_a = 0; |
| 314 |
twait_time[twait_a] = 0; |
| 315 |
twait_wait[twait_a] = twait_old; |
| 316 |
twait_a++; |
| 317 |
if( NF==14) { # original file was missing this |
| 318 |
policy="FIFO"; |
| 319 |
alg ="InOrder"; |
| 320 |
} |
| 321 |
else if(NF>=18) { # newer files have this format |
| 322 |
policy = $18; |
| 323 |
alg = $16; |
| 324 |
if( alg=="drain-ends") big = $20; |
| 325 |
} |
| 326 |
|
| 327 |
start = $4; # this is the start time of the first dump |
| 328 |
# taper idle to this point should not be included |
| 329 |
run_old = no_disks*cont_scale+que_raise; |
| 330 |
print 0, run_old >"run_queue"; |
| 331 |
finish_old = tapeQ_old = que_raise; |
| 332 |
print 0, finish_old >"finished"; |
| 333 |
print 0, tapeQ_old >"tape_queue" ; |
| 334 |
state_old = tape_raise; |
| 335 |
print 0, state_old > "tape_idle"; |
| 336 |
active_old = dump_raise; |
| 337 |
print 0,active_old >"dump_idle"; |
| 338 |
|
| 339 |
} |
| 340 |
|
| 341 |
function do_quit(){ # this is issued by driver at the end |
| 342 |
# when it has nothing more to do |
| 343 |
cnt++; |
| 344 |
quit = 1; |
| 345 |
tim = $4 / time_scale; |
| 346 |
|
| 347 |
disk_alloc_time[disk_a] = tim; |
| 348 |
disk_alloc_space[disk_a] = holding_disk_old; |
| 349 |
disk_a++; |
| 350 |
max_space=disk_alloc_space[0]; |
| 351 |
for(a=0; a<disk_a; a++) { |
| 352 |
if(disk_alloc_space[a] > max_space) { |
| 353 |
max_space = disk_alloc_space[a]; |
| 354 |
} |
| 355 |
} |
| 356 |
|
| 357 |
space_change = 0; |
| 358 |
if(max_space > holding_disk) { |
| 359 |
space_change = max_space - holding_disk; |
| 360 |
holding_disk = max_space; |
| 361 |
} |
| 362 |
|
| 363 |
twait_time[twait_a] = tim; |
| 364 |
twait_wait[twait_a] = twait_old; |
| 365 |
twait_a++; |
| 366 |
min_wait=twait_wait[0]; |
| 367 |
for(a=0; a<twait_a; a++) { |
| 368 |
if(twait_wait[a] < min_wait) { |
| 369 |
min_wait = twait_wait[a]; |
| 370 |
} |
| 371 |
} |
| 372 |
if(min_wait < 0) { |
| 373 |
if(flush_size == 0) { |
| 374 |
holding_disk -= min_wait; |
| 375 |
holding_disk -= space_change; |
| 376 |
} |
| 377 |
for(a=0; a<twait_a; a++) { |
| 378 |
twait_wait[a] -= min_wait; |
| 379 |
} |
| 380 |
} |
| 381 |
if (holding_disk != 0) { |
| 382 |
const = 100/holding_disk; |
| 383 |
} |
| 384 |
else { |
| 385 |
const = 100; |
| 386 |
} |
| 387 |
for(a=0; a<disk_a; ++a) { |
| 388 |
space = (holding_disk - disk_alloc_space[a])*const+disk_raise |
| 389 |
printf plot_fmt1, disk_alloc_time[a], space >> "disk_alloc"; |
| 390 |
} |
| 391 |
for(a=0; a<twait_a; ++a) { |
| 392 |
space = (twait_wait[a])*const+disk_raise |
| 393 |
printf plot_fmt1, twait_time[a], space >> "tape_wait"; |
| 394 |
} |
| 395 |
|
| 396 |
printf plot_fmt, tim, active_old, tim, dump_raise >>"dump_idle"; |
| 397 |
printf plot_fmt, tim, state_old, tim, tape_raise >>"tape_idle"; |
| 398 |
printf plot_fmt, tim, unused_old, tim, bandw_raise >>"bandw_free"; |
| 399 |
printf plot_fmt, tim, finish_old, tim, written*count_scale+que_raise >>"finished"; |
| 400 |
printf plot_fmt, tim, run_old, tim, run_old >>"run_queue"; |
| 401 |
} |
| 402 |
|
| 403 |
function do_result(){ # process lines driver: result |
| 404 |
if($7=="DONE" ) { |
| 405 |
if( match($6, /^taper/)) { # taper done |
| 406 |
tsize -= $14; |
| 407 |
tout += $14; |
| 408 |
tcnt--; written++; |
| 409 |
} |
| 410 |
else if (match($6, /^dumper/)) { # dumperx done |
| 411 |
tsize += (int($17/32)+1)*32; # in tape blocks |
| 412 |
tcnt++; done++; |
| 413 |
xx = host[$6]; |
| 414 |
d = disk[$6]; |
| 415 |
l = level[$6]; |
| 416 |
host_time[xx]+= ( tt = $4 - dmpr_strt[$6]); |
| 417 |
if(xx in disk_list) disk_list[xx] = disk_list[xx] "\n"; |
| 418 |
disk_list[xx] = disk_list[xx] \ |
| 419 |
xx ":" d "/" l "\t" \ |
| 420 |
pr_time(dmpr_strt[$6]) \ |
| 421 |
" - " pr_time($4) \ |
| 422 |
" = " pr_time(tt); |
| 423 |
# print host[$6], disk[host[$6]]; |
| 424 |
# print host[$6], $4, dmpr_strt[$6], host_time[host[$6]] |
| 425 |
} |
| 426 |
} |
| 427 |
else if ($6=="taper:") { # something else than DONE |
| 428 |
if($7=="TAPE-ERROR" || $7=="TRY-AGAIN") { |
| 429 |
tape_err= 1; |
| 430 |
err_time=$4/time_scale; |
| 431 |
} |
| 432 |
else if ($7=="TAPER-OK") tape_err=0; |
| 433 |
else if ($7=="PORT") tape_err=0; |
| 434 |
else if ($7=="REQUEST-NEW-TAPE") tape_err=0; |
| 435 |
else if ($7=="NEW-TAPE") tape_err=0; |
| 436 |
else if ($7=="PARTDONE") tape_err=0; |
| 437 |
else if ($7=="DUMPER-STATUS") tape_err=0; |
| 438 |
else print fil, "UNKNOWN STATUS# "$0 ; |
| 439 |
} |
| 440 |
else { # something bad from dumper |
| 441 |
if ($7=="FAILED") { failed++;} |
| 442 |
else if ($7=="TRY-AGAIN"){ try++;} |
| 443 |
else if ($7=="REQUEST-NEW-TAPE") ; # ignore from taper |
| 444 |
else if ($7=="NEW-TAPE") ; # ignore from taper |
| 445 |
else if ($7=="READY") ; # ignore from taper |
| 446 |
else if ($7=="PARTDONE") ; # ignore from taper |
| 447 |
else if ($7=="DUMPER-STATUS") ; # ignore from taper |
| 448 |
else if ($7=="CLOSED-VOLUME") ; # ignore from taper |
| 449 |
else if ($7=="TAPER-OK") ; # ignore from taper |
| 450 |
else if ($7=="TAPER-OK") ; # ignore from taper |
| 451 |
else if ($7=="TAPER-OK") ; # ignore from taper |
| 452 |
else if ($7=="SHM-NAME") ; # ignore from chunker or taper |
| 453 |
else if ($7=="PORT") ; # ignore from chunker |
| 454 |
else if ($7=="RQ-MORE-DISK") ; # FIXME: ignore for now |
| 455 |
else if ($7=="NO-ROOM") |
| 456 |
print fil, pr_time($4),"#" ++no_room, $0; |
| 457 |
else if( $7=="ABORT-FINISHED") print fil, "#" ++no_abort, $0; |
| 458 |
else print fil, "UNKNOWN STATUS# " $0; |
| 459 |
} |
| 460 |
} |
| 461 |
|
| 462 |
function do_moves() { # function that extracts the estimated size of dumps |
| 463 |
# by processing DELAYING and promoting lines |
| 464 |
est_size=$6; |
| 465 |
getline ; # eat get next line print out planner msg |
| 466 |
while (NF > 0 && (($1 == "delay:") || ($1 == "planner:")) ) { |
| 467 |
if( $1 == "delay:") est_size = $NF; # processing delay lines |
| 468 |
else print fil, "DELAY#", $0; |
| 469 |
getline; |
| 470 |
} |
| 471 |
getline ; # eating blank line |
| 472 |
if( $1== "PROMOTING") { # everything is dandy |
| 473 |
getline; # get first promote line |
| 474 |
while ( NF>0 && ($1 == "promote:" || $1 == "planner:" || $1 == "no" || $1 == "try") ) { |
| 475 |
if( $2 == "moving") { |
| 476 |
est_size=$8; |
| 477 |
print fil, "PROMOTING#", $1, $3; |
| 478 |
} |
| 479 |
else if($2 != "checking" && $2 != "can't" && $3 != "too" && $1 != "no" && $1 != "try" && $2 != "time") |
| 480 |
print fil,"PROMOTING#", $0; |
| 481 |
getline ; # get next promote line |
| 482 |
} |
| 483 |
} |
| 484 |
else print fil, "DID NOT FIND PROMOTING LINE IN THE RIGHT PLACE",NR,$0; |
| 485 |
} |
| 486 |
|
| 487 |
|
| 488 |
END { |
| 489 |
if( holding_disk == -1) { # bad input file |
| 490 |
print fil,": MISSING SPACE DECLARATION" ; |
| 491 |
exit; |
| 492 |
} |
| 493 |
# print headers of each graph this is for the gnulot version |
| 494 |
if( tim >maxtime && extend==0)# if graph will extend beond borders |
| 495 |
printf "Graph extends beond borders %s taking %7.3f > (max = %7.3f)\n", |
| 496 |
fil, tim, maxtime ; |
| 497 |
print_t(); # print titles |
| 498 |
if( no_room + no_abort > 0) |
| 499 |
printf "NO-ROOM=%5d ABORT-FINISHED=%5d\n", no_room, no_abort; |
| 500 |
max_out = 20; |
| 501 |
old_t = min_host * min_host; # Some thing big |
| 502 |
print "Longest dumping hosts Times", min_host; |
| 503 |
print "Host:disk/lev \t start - end = run\t=> total"; |
| 504 |
while ( max_out-- > 0 && old_t > min_host) { |
| 505 |
t = 0; |
| 506 |
for (j in host_time) { |
| 507 |
if( t < host_time[j] && host_time[j] <old_t){ |
| 508 |
t = host_time[d=j]; |
| 509 |
} |
| 510 |
} |
| 511 |
printf "%s: %s\t => %s\n\n", d, disk_list[d], pr_time(host_time[d]); |
| 512 |
# printf "%-20.20s Total Dump time %s\n", d, pr_time(host_time[d]); |
| 513 |
old_t = t; |
| 514 |
} |
| 515 |
} |
| 516 |
|
| 517 |
function print_t(){ # printing out the labels for the graph |
| 518 |
label=0; # calculating where labels go and |
| 519 |
# range for x and y axes |
| 520 |
maxy = int(no_disks/60+1)*20+que_raise; |
| 521 |
printf "set yrange[0:%d]\n",maxy >"title"; |
| 522 |
if( maxtime < tim && extend !=0) { |
| 523 |
printf "set xrange[0:%d]\n", tim+30 >>"title"; |
| 524 |
first_col = 10; |
| 525 |
second_col = (tim+30) * 0.45; |
| 526 |
key_col = (tim+30) * 1.042; |
| 527 |
third_col = (tim+30) * 1.0125; |
| 528 |
} |
| 529 |
else { |
| 530 |
printf "set xrange[0:%d]\n", maxtime >>"title"; |
| 531 |
first_col = maxtime * 0.042 |
| 532 |
second_col = maxtime * 0.45 |
| 533 |
key_col = maxtime; |
| 534 |
third_col = maxtime*1.0125; |
| 535 |
} |
| 536 |
label_shift = (7 + int(no_disks/100)); |
| 537 |
lab = label_start = maxy+(6*label_shift) ; # showing 6 labels |
| 538 |
printf "set key at %d, %d\n", key_col, lab+4 >>"title"; |
| 539 |
printf "set label %d \"Amanda Dump %s\" at %d,%d\n", ++label,fil, |
| 540 |
first_col,lab >"title"; |
| 541 |
lab -= label_shift; |
| 542 |
printf "set label %d \"Bandwidth = %d\" at %d,%d\n",++label,bandw, |
| 543 |
first_col,lab >>"title"; |
| 544 |
|
| 545 |
lab -= label_shift; |
| 546 |
printf "set label %d \"Holding disk = %d\" at %d,%d\n",++label,size, |
| 547 |
first_col,lab >>"title"; |
| 548 |
|
| 549 |
lab -= label_shift; |
| 550 |
printf "set label %d \"Tape Policy = %s\" at %d,%d\n",++label,policy, |
| 551 |
first_col,lab >>"title"; |
| 552 |
|
| 553 |
lab -= label_shift; |
| 554 |
printf "set label %d \"Dumpers= %d\" at %d,%d\n",++label,dumpers, |
| 555 |
first_col,lab >>"title"; |
| 556 |
|
| 557 |
lab -= label_shift; |
| 558 |
if( alg =="drain-ends") |
| 559 |
printf "set label %d \"Driver alg = %s At big end %d\" at %d,%d\n", |
| 560 |
++label,alg, big,first_col,lab >>"title"; |
| 561 |
else #if( alg =="InOrder") # other special cases |
| 562 |
printf "set label %d \"Driver alg = %s\" at %d,%d\n", |
| 563 |
++label,alg,first_col, lab >>"title"; |
| 564 |
|
| 565 |
lab = label_start; |
| 566 |
printf "set label %d \"Elapsed Time = %s\" at %d,%d\n", |
| 567 |
++label,pr_time(tim*60),second_col,lab >>"title"; |
| 568 |
|
| 569 |
lab -= label_shift; |
| 570 |
if( tape_err==1) stm = "TAPE ERROR"; |
| 571 |
else if( quit ==1) stm = "SUCCESS"; |
| 572 |
else { stm = "UNKNOWN"; |
| 573 |
print "Unknown terminating status",fil; |
| 574 |
} |
| 575 |
printf "set label %d \"Final status = %s\" at %d,%d\n", |
| 576 |
++label,stm, second_col,lab >> "title"; |
| 577 |
|
| 578 |
lab -= label_shift; |
| 579 |
printf "set label %d \"Dumped/Failed = %3d/%d\" at %d,%d\n", |
| 580 |
++label,done,(failed+(try/2)), second_col,lab >>"title"; |
| 581 |
|
| 582 |
lab -= label_shift; |
| 583 |
printf "set label %d \"Output data size = %d\" at %d, %d\n", |
| 584 |
++label,int(tout/1024+0.49999),second_col,lab >>"title"; |
| 585 |
if( est_size >0) { |
| 586 |
lab -= label_shift; |
| 587 |
printf "set label %d \"Estimated data size = %d\" at %d, %d\n", |
| 588 |
++label,int(est_size/1024+0.49999),second_col,lab >>"title"; |
| 589 |
} |
| 590 |
|
| 591 |
if (gnuplot==0) { |
| 592 |
printf "set output \"%s.ps\"\n",fil >>"title"; |
| 593 |
if(bw==1) { |
| 594 |
if(paper==1) printf "set term postscript landscape \"Times-Roman\" 10\n" >>"title"; |
| 595 |
else printf "set term postscript portrait \"Times-Roman\" 10\n" >>"title"; |
| 596 |
} |
| 597 |
else { |
| 598 |
if(paper==1) printf "set term postscript landscape color \"Times-Roman\" 10\n" >>"title"; |
| 599 |
else printf "set term postscript portrait color \"Times-Roman\" 10\n" >>"title"; |
| 600 |
} |
| 601 |
} else { |
| 602 |
printf "set term x11\n" >> "title"; |
| 603 |
} |
| 604 |
printf "set ylabel """";" >>"title"; # make sure there is no ylabel |
| 605 |
fmt= "set label %d \"%s\" at "third_col", %d\n"; |
| 606 |
printf fmt, ++label,"%DUMPERS", 40 >>"title"; |
| 607 |
printf fmt, ++label,"TAPE", 95 >>"title"; |
| 608 |
printf fmt, ++label,"HOLDING",180 >>"title"; |
| 609 |
printf fmt, ++label,"DISK", 160 >>"title"; |
| 610 |
printf fmt, ++label,"%BANDWIDTH", 260 >>"title"; |
| 611 |
printf fmt, ++label,"QUEUES",(que_raise+maxy)/2 >>"title"; |
| 612 |
if((paper+gnuplot) > 0) print "set size 0.9, 0.9;" >>"title"; |
| 613 |
else print "set size 0.7,1.3;" >>"title"; |
| 614 |
} |
| 615 |
|
| 616 |
function pr_time(pr_a){ #function to pretty print time |
| 617 |
pr_h = int(pr_a/3600); |
| 618 |
pr_m = int(pr_a/60)%60; |
| 619 |
pr_s = int(pr_a+0.5) %60; |
| 620 |
if( pr_m < 10 && pr_s < 10 ) return pr_h":0"pr_m":0"pr_s; |
| 621 |
else if( pr_s < 10) return pr_h":" pr_m":0"pr_s; |
| 622 |
else if( pr_m < 10) return pr_h":0"pr_m":" pr_s; |
| 623 |
else return pr_h":" pr_m":" pr_s; |
| 624 |
} |