#!/usr/bin/env ruby =begin = bos (broadcast oracle sql) == USAGE stat-upg-sap filename where file name is R3up.log you find in /usr/sap/put/log during an upgrade During a SAP R/3 upgrade, the file /usr/sap/put/log/R4ip.log is created and it contains information about when a phase starts and ends. You can use this script to extract statistics from this file. The output is PHASE_NAME PHASE_TIME(seconds) PHASE_DIALOG_TIME(seconds) PARTIAL_TOTAL_TIME(seconds) == HISTORY * 2003-01-28, Matteo: the previous versions of this tool were written in Perl. Axioma: A phase finishes when a new phase starts and not when you meet a line such as "finished at..." This is because you couldn't find that line if you kill the R3up process... * 2003-01-29, Matteo: dialogue time is removed from phase and upgrade time... == AUTHOR E-MAIL: matteo.redaelli@libero.it WEB: http://digilander.iol.it/reda == LICENSE This package is free software; you can redistribute it and/or modify it under the terms of the "Artistic License" or the "GNU General Public License". == DISCLAIMER This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =end phase = "__BEGIN__" # step = # 0, when "started at" is met, it will be start_of_phase # 1, when "started at" is met, it will be ignored # 2, when "started at" is met, it will be end_of_phase step = 0 filename = ARGV[0] start_of_phase = end_of_phase = Time.new start_of_dial = Time.new phase_sec = upg_sec = dia_sec = 0 IO.foreach( filename ) { |line| case line when /^#/ # skipping lines starting with # next when /^UPGRADEPHASE (.*)/ phase_new = $1 if not (phase == "__BEGIN__") and not (phase == phase_new) step = 2 print "#{phase}\t" end phase = phase_new when /^\.\.\.started at (....)(..)(..)(..)(..)(..)$/ t = Time.gm( $1, $2, $3, $4, $5, $6) if step == 2 step = 0 end_of_phase = t phase_sec = (end_of_phase - start_of_phase).to_i - dia_sec upg_sec += phase_sec print "#{phase_sec}\t#{dia_sec}\t#{upg_sec}\n" dia_sec = 0 end if step == 0 step = 1 start_of_phase = t end when /^\.\.\.begin dialogue at (....)(..)(..)(..)(..)(..)$/ start_of_dial = Time.gm( $1, $2, $3, $4, $5, $6) when /^\.\.\.end dialogue at (....)(..)(..)(..)(..)(..)$/ t = Time.gm( $1, $2, $3, $4, $5, $6) dia_sec += (t - start_of_dial).to_i end # puts line }