View previous topic :: View next topic
|
Author |
Message |
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I have transactions in file as below
transid intime outime trantype
t1 22.23.12.9 22.23.14.4 pay1
t2 22.23.20.5 22.23.23.8 pay1
t3 23.24.12.6 22.25.13.7 pay1
t4 23.25.22.9 22.26.15.6 pay1
.. ... ... ...
In this way I have lakhs of transactions in file and
format of intime and outime are hh:mm:ss:ms
Now using rexx program i want to calculate below two figures
Start of time period avg no of transaction per 10 second
(sec) ( no)
10 ----
20 ----
30 ----
40 ---
50 ---
1.0 ---
1.10(min.sec) ---
1.20 ---
start of time period is incremented to 10 sec each time and i want to calculate the its avg no of transaction per 10 sec value .i.e ---value
By subtracting intime from outtime i will get the time taken by particular transaction for processing
Can anyone tell me logic to archive this?
Thanks |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
You get the average by counting the records per interval, summing all of the counts, and dividing by the total number of intervals.
Perhaps you should post in the math help forum |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I have tried with logic but it is giving me incorrect data
Code: |
"execio * diskr inreptr (finis stem in_rept."
do i=1 to in_rept.0
parse var in_rept.i l1 ',' l2 ',' l3 ',' l4 ',' l5 ',' l6 ',' l7 ','
paytype=strip(l12)
If pos('XXXXX',paytype) = 0 then do
intime=strip(l2)
outime=strip(l3)
parse var intime hh ':' mm ':' ss '.' ms
Ihh = hh*3600
Imm = mm*60
Iss = ss
Ims = ms/100
tot_intime = Ihh + Imm + Iss + Ims
parse var outime hh ':' mm ':' ss '.' ms
Ohh = hh*3600
Omm = mm*60
Oss = ss
Oms = ms/100
tot_outime = Ohh + Omm + Oss + Oms
tot_tran_time = tot_outime - tot_intime
prv_tran_time.i = tot_tran_time
if tot_tran_time >= 10.00 then do
if prv_tran_time.i-1 < 10.00 then do
tran_cnt = tran_cnt + 1
tot_tran_time = tot_tran_time + prv_tran_time.i-1
tran_cnt = 10*tran_cnt/tot_tran_time
say 'no of trans in 10 sec interval:'tran_cnt
end
else do
tran_cnt = tran_cnt + 1
say 'no of trans in 10 sec interval:'tran_cnt
end;
tran_cnt =0
end;
else do
if exceeds_flag ='yes' then do
sum_time = sum_time + tot_tran_time + pen_tran_time
exceeds_flag ='no'
end
else do
sum_time = sum_time + tot_tran_time
end
if sum_time <= 10.00 then do
tran_cnt = tran_cnt + 1
end;
if sum_time > 10.00 then do
sum_time = sum_time - tot_tran_time
if sum_time <= 10.00 then do
pen_tran_time = tot_tran_time
exceeds_flag ='yes'
end
if sum_time = 10.00 | exceeds_flag ='yes' then do
if exceeds_flag ='yes' then do
tran_cnt = tran_cnt - 1
end
fil_cnt = fil_cnt + 1
fil_rec.fil_cnt = tran_cnt
say 'no of trans in 10 sec interval:'tran_cnt
if exceeds_flag ='yes' then tran_cnt = 1
tran_cnt = 0
sum_time = 0
end;
end;
end;
end; |
Code'd
The file is having transaction as i mentioed earlier .The logic became to much complicated and it is giving me incorrect data. can You please help
Can you please suggest any simpler logic or try to correct above
thanks, |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
your code is missing some comments.
What do your results look like?
Your initial question is somewhat complex, so the logic to implement has to be somewhat complex also. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
I am trying to calculate as belwo
say 1st trans took .79 sec
2nd took 2.3 sec
3 take 2.5 sec
4 th take 5 sec for processing
i am tring to add those value and compare with 10 sec and counting no of transaction in that 10 sec but issue is coming as their summasion must not be equal to 10 alltime it might be 10.2 it mighnt be 12,5
so how to take care of that and suppose only single transaction take more than 10 sec say 22 sec for processing then how to take care of this scenarios
Please suggest ...with some beautiful logic |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
am tring to add those value and compare with 10 sec and counting no of transaction in that 10 sec but issue is coming as their summasion must not be equal to 10 alltime it might be 10.2 it mighnt be 12,5 |
Please clarify. . .
I (for one) do not understand what this is is telling me. . . |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
I also am not sure what you are trying to do... you have not stated it well.
But I get the impression you are worried about completion of transactions but I think it would be much simpler if you only worried about arrival rates. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
As I mentioned i have transaction file as belwo
ransid intime outime trantype
t1 22.23.12.9 22.23.14.4 pay1
t2 22.23.20.5 22.23.23.8 pay1
t3 23.24.12.6 22.25.13.7 pay1
t4 23.25.22.9 22.26.15.6 pay1
There are aroud 50000 records in file . What I need to do is
Calculate number of transactions completed per 10 sec
and transaction completion time is nothing but outtime-intime
say first traansaction took 2 sec(i.e outime -intime = 2sec) ,second took 3 sec and third took 5 sec
that means for first 10 sec, no of transaction are 3 (b'cz time 2sec+3 sec+5 sec =10sec) so this 3 will be my first output
Now sameway for next 10 sec we need to calculate no of transaction performed
then again for next 10 sec this will continue till end of file
The issue is time taken by transaction might be in decimal like 0.79,0.20
so when I tried to sum all these to match whether it is equal to 10 sec then
it never get satisfied and in some case time taken by transaction may be grater than 10 sec.. This needs to be taken care somehow.. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Is there some business reason to do this in rexx?
It is a fairly trivial bit of cobol code. . .
Quote: |
This needs to be taken care somehow.. |
This needs specific rules on how to handle. . . You have to make/post the rules. I suspect that there will be many "overruns" / "overlaps" . . . |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
You want:
Quote: |
What I need to do is Calculate number of transactions completed per 10 sec |
but the issue you raise has to do with both started and completed in the same interval. If that is really what you want, then you have to ignore transactions that took longer than 10 seconds (they cannot be categorized using the rule you have stated).
If you cannot ignore records, then perhaps try to determine in which 10 second interval the majority of the time was used. Given this:
t5 23.25.25.9 22.26.30.6 pay1
I would say 4.1 seconds occurred in the 20's interval and 0.6 seconds in the 30's interval, so this particular transaction would be added to the 20's count.
Note: the table of records you provided does not match your written description of the time intervals. Please be consistent within your examples.
Part of your description wants to sum up the times, but I do not think you need a sum of the times. You are ignoring gaps of empty time. You only need to know which interval a transaction completed in and add 1 to the total for that interval. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
It appears to me you are making this far more complicated than it needs to be.
Since the only purpose the time serves is to caluculate elapsed time per transaction, try this.
Add up the number of transactions and the total elapsed time.
Avgtime = tot_time / tot_trans
Avg_per_10sec = 10 / avgtime
Trying to break it into 10 second intervals as you go is a total wasted effort.
Lets try an example:
t1 5 sec
t2 2
t3 2
t4 1
First 10 seconds = 4 transactions
t5 6
t6 4
Next 10 seconds = 2 transactions
Average of the 2 sets of 10 seconds = 3 transactions
The average as a whole:
20 seconds / 6 transactions = 3.33 seconds per trans
10 / 3.33 = 3 transactions per 10 seconds
Exactly the same and a lot easier. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Dave, you have a different understanding of the problem than I do. I think the OP needs to clarify more what he is trying to do.
My understanding is that it not about adding the elapsed times until they add up to ten seconds, but rather about how many transactions fall within a certain interval.
I guess I am thinking about real world situations where there can be several transactions running at the same time with overlapping start and stop times. And also gaps when nothing is running.
btw, I think the interval is too short. You will see performance measurements in trx/minute or trx/hour but I have never seen it in trx/10secs. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
And it may be that the SLA for that set of transactions is 10 seconds and the goal is to determine what % of the transactions meet the SLA. . .
I not seen anyone yet try to calculate these kinds of numbers "serially" (which would not be very difficult). Most/all of the systems i work with have dozens to thousands of transactions running concurrently and most overlap making for a differenc kind of calculation.
Possibly we'll receive additional info we can use to help. . . |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
You are right Dick we need to plot graphs based on figures that we receive by doing above calculation. and based on graph we will measure performance and everything
Now to make it more simpler we need to calculate below thing
Need to calculate no of transaction performed in 1 min time period
so start will be from 1 min as belwo
1 min tpm(transaction per min)
2 min tpm
3 min tpm
4 min tpm
5 min tpm
6 min tpm
etc
that tpm value I need to calculate .. Please help me with logic as soon as possible
note.. transaction completion time is nothing but out time-in time as i mentioned earlier
Thanks in advance |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you create an array of the time intervals you want to track (i.e. 1 min, 2 min. . . n min and > max).
Determine the elapsed time of each transaction (outtime - intime) and add to the appropriate array entry. If the elapsed time is > max, add to the "over max" entry. These "over max" transactons may need additional investigation to determine why they took an inordinate amount of time. |
|
Back to top |
|
|
MBabu
Active User
Joined: 03 Aug 2008 Posts: 400 Location: Mumbai
|
|
|
|
I don't get the problem either.
you are assuming some definition of 'transactions per minute' but we don't know what that means by your description.
Is 'per minute' defined as per minute of elapsed run time? or is it time of day, say between 18:59 and 19:00?
Is 'transactions' the number of transactions completed or the number of transactions actually running during the interval including those that span intervals?
I don't understand how the time it takes to run a transaction (outtime-intime) has any effect on transactions per minute in a multi-tasking system where you will have many transactions running at the same time.
Forget about the implementation for a while: What is the exact problem you are trying to solve?
(also, a word of etiquette: Please review your posts for basic things like spelling and don't use chat shortcuts... People will not put more effort into the finding the answer than the effort you put into posing the question). |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
pdighade,
I have read this thread 3 times, and I still don't understand what your request is...
pdighade wrote: |
say 1st trans took .79 sec
2nd took 2.3 sec
3 take 2.5 sec
4 th take 5 sec for processing
i am tring to add those value and compare with 10 sec and counting no of transaction in that 10 sec |
pdighade wrote: |
say first traansaction took 2 sec(i.e outime -intime = 2sec) ,second took 3 sec and third took 5 sec
that means for first 10 sec, no of transaction are 3 (b'cz time 2sec+3 sec+5 sec =10sec) so this 3 will be my first output
Now sameway for next 10 sec we need to calculate no of transaction performed
then again for next 10 sec this will continue till end of file |
How can you add these values, if you don't take into account the "intime".
Using your example, you will have 3 trans (t1+t2+t3) in 10 sec:.
You're counting 3 trans in less than 10 seconds when in fact more than 2 minutes elapsed between the beginning of t1 and the end of t3.
pdighade wrote: |
start of time period is incremented to 10 sec each time and i want to calculate the its avg no of transaction per 10 sec value .i.e ---value |
pdighade wrote: |
Need to calculate no of transaction performed in 1 min time period |
This request has nothing to do with the transaction duration, you need to use the "intime" only. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
pdighade,
Let me see if I understand this...
I have been charged for X number of seconds of time for a specific transaction.
I want to know what the average number of transactions were executed for each ten second interval of charged time.
I want to see how that number changes from the first 10 second interval until the last ten second interval.
Am I close?
I'd actually prefer the average elapsed time of the transaction for each 5 or 10 minute interval during the day.... |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
Pdighade,
Please give us 20 real records and show us the math you do on them manually to get TPM and show us the results that you get. Then maybe we can help you write a program does the same.
==========
A few people have said there is no reason to compute the outtime-intime... just use either the intime -or- the outtime.
Just truncate that time to give you which interval it falls in. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello pdighade,
Quote: |
that tpm value I need to calculate .. Please help me with logic as soon as possible |
You insist on non-standard terminology and then want it asap. . .
Please consider that if the best 2 of us were on-site and available to implement the requirement definition, we could do little. . . So far, there is no usable description/definition ("tpm" is not effectively communicating). You believe there is something easily attainable (and it probably is easily obtainable) and most likely something that many of us have done multiple ways. To you the requirement is obvious. Unfortunately it has not been clear to the people would help if they could.
As Pedro requested you need to post the "output" you want from 20 real records. Make sure these sample records cover all cases you want reported. |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2546 Location: Silicon Valley
|
|
|
|
you say it is for performance measurement...
I question why you are checking in 10 second or even 1 minute intervals. Say you have good performance all day, but real bad performance in only one 10 second interval. What will you do? I do not think you can tune your system so quickly. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Your claim is that you are doing performance management, but you seem to be doing things in ways that are not standard to the industry. Have you looked at what the Computer Measurement Group provides as a guide to industry practices? What background do you have in computer performance measurement? Have you considered using your site's WLM data as a starting point rather than creating your own statistics and thus reinventing the wheel?
Using 10-second intervals is ludicrous -- that gives you 8,640 intervals per day, or 2,880 per shift. There is no way you can meaningfully do any kind of tuning on that number of intervals. 15-minute or 30-minute intervals are more commonly used and at least meaningful tuning can be done with that interval size. |
|
Back to top |
|
|
pdighade
New User
Joined: 21 Jul 2008 Posts: 40 Location: pune
|
|
|
|
Robert,
Yes now I am trying with 30 min interval now. and will let you know if any issue occured |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The length of the interval is only one part of the equation. Even with a 10-minute "interval", there will be thousands and thousands of "interval overlaps".
You still need to determine the "rules" and post them.
As i mentioned earlier, what i believe you want to do is not difficult. . . It merely needs to be specified clearly.
Now is surely a good time to generate some representative "output" from a set of realistic sample data. |
|
Back to top |
|
|
|