Tuesday, December 15, 2009

Averatec 1000 Series Wireless Drivers



Here is a simple script, which gave a log file, is responsible to extract statistics:
############ ############################################# # Example file log analysis
01:45:20,626; b13cc410-E126-11de-b53c-00000a1d3a10; requestCreateIPPBXCLI1, IN;
09:54:20,626; b13cc410-E126-11de-b53c-00000a1d3a11; requestCreateIPPBXCLI1, IN;
10:59:20,626; b13cc410 -E126-11de-b53c-00000a1d3a11; requestCreateIPPBXCLI1; OUT;
11:23:20,626; b13cc410-E126-11de-b53c-00000a1d3a10; requestCreateIPPBXCLI1; OUT;
############### #########################################

à # / usr / bin / awk-f #
Defining a function, which covered up the hours, minutes and seconds in ms
# # => 01:45:20,626 37920626 becomes
msTime function (h) {
split (h, TIMETMP ,":") # Format time
split (TIMETMP [3], TIMEMS, "") # format the seconds
TIMETMP ms [1] TIMETMP = [1] * 60 # Convert minutes into hours
TIMETMP [2] = TIMETMP [2] + TIMETMP [1] # Supreme minutes
TIMETMP [2] = TIMETMP [2] * 60 # Convert seconds in minutes
TIMEMS [1] = TIMEMS [1] + TIMETMP [2] # second the Supreme TIMEMS [1] = TIMEMS [1] * 1000 # Converting ms TIMEMS [2] = TIMEMS [1] + TIMEMS [2] # Supreme ms the return TIMEMS [2]} # In


BEGIN, the code is performed first to analyze all the log files
# BEGIN We can say that in preparing the log file to be analyzed

BEGIN {FS = "" # Field Separator
default is the backspace, but in the log file fields of interest are separated by #, and then use it as a field separator split (ARGV [1], RequestType ,"=") # ARGV [1] corresponds to the parameter request = NomeRequest. This parameter #
past interests me only NomeRequest, so do I a split of the parameter, # obtaining a data structure of type
# RequestType [1] = request
# RequestType [2] = NomeRequest
count = 0
}
# In general it holds that:
# 1) Songolo Each line of the log file is seen by awk as a record
# 2) sonoglo Each record is divided into fields that are separated in this case;
# 3) Since the 1 and 2 we have: Record # =
> 01:45:20,626; b13cc410; requestCreateIPPBXCLI1, IN;

# $ 1 => 01:45:20,626;
# $ 2 => b13cc410;
$ 3 => requestCreateIPPBXCLI1;
# $ 4 => IN;

REQUEST [NR] = $ 3 # NR is a variable of awk, which indicates that you are # NunmberRecord analyzing. In particular you scroll through all the records automatically without # cycling with some loop TIME [NR] = $ 1 # read the time stamp of a single entry
ID [NR] = $ 2 # Stores the ID of the request
}

# Part of the analysis code used at the end of the file

END {for (j = 1, j
for (i = 1; the
if ((ID [j] == ID [i = ])&&( J! i) & & (request [i] == RequestType [2])) {
count + +
ID [j] = "00"
print TIME [i]
print TIME [j]
t2 = msTime (TIME [i])
print t2
t1 = msTime (TIME [j])
print t1
TIMEDEF [count] = t2-t1 # This stores the samples # print timestamp
TIMEDEF [count]

} # Timestamp
Search Max = maximum TIMEDEF [1]

for (i = 1; the
if (TIMEDEF [ i]> maximum) {
maximum TIMEDEF = [i]}


} print "Max value =>" maximum
print "Max Val Index =>" indiceMax

sum = 0 # Min Timestamp Research and averaging the samples obtained
minimum = TIMEDEF [1]
for (i = 1; the
if (TIMEDEF [i] = minimum
TIMEDEF [i]}

sum = sum + TIMEDEF [i]}

print "Minimum value =>" media = minimum
sum / count
print "Value medium => "# Media
average of samples obtained (sample-> timestamp difference of the same UUID)


if (count == 0)
print" Request name wrong, or the log file does not contain the request or analyzed the log file there is only the IN or OUT

maximum print "," minimum "," count "," media> "/ tmp / prova.csv"


} # end end

<=NR; j++)

<=NR; i++)