home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 11 Util
/
11-Util.zip
/
TRACK.ZIP
/
MULTIUSR.SQL
< prev
next >
Wrap
Text File
|
1989-05-17
|
2KB
|
73 lines
/* */
/* These procedures calculate the results information */
/* */
use bench_stat
go
drop procedure tp_comp_multiuser
go
create procedure tp_comp_multiuser @multi_number int, @start int, @end int as
declare @errs int, @max_exec int, @min_exec int, @avg_exec float,
@tot_exec int, @loopcnt int, @iterate int, @outline varchar(255),
@elapsed int, @tmp int, @tmp1 float, @sdate datetime, @edate datetime,
@tot_avg_exec float, @tot_under1 int, @tot_under2 int
select @loopcnt = @start
select @max_exec = 0
select @min_exec = 2147483647
select @tot_exec = 0
select @tot_avg_exec = 0.0
select @iterate = 0
select @errs = 0
select @elapsed = 0
select @tot_under1 = 0
select @tot_under2 = 0
/* Get the raw totals */
while @loopcnt <= @end
BEGIN
select @errs = @errs + (select errors from runs where number = @loopcnt)
select @tmp = max_exec from runs where number = @loopcnt
if @tmp >= @max_exec
select @max_exec = @tmp
select @tmp = min_exec from runs where number = @loopcnt
if @tmp <= @min_exec
select @min_exec = @tmp
select @tot_exec = @tot_exec + (select tot_exec from runs where number = @loopcnt)
select @tot_avg_exec = @tot_avg_exec + (select avg_exec from runs where number = @loopcnt)
select @iterate = @iterate + (select iterations from runs where number = @loopcnt)
select @sdate = start_time from runs where number = @loopcnt
select @edate = end_time from runs where number = @loopcnt
select @tmp = datediff(second,@sdate,@edate)
select @elapsed = @elapsed + @tmp
select @tot_under1 = @tot_under1 + (select under1_exec from runs where number = @loopcnt)
select @tot_under2 = @tot_under2 + (select under2_exec from runs where number = @loopcnt)
select @loopcnt = @loopcnt + 1
END
/* Calculate average exec time */
select @avg_exec = @tot_avg_exec/((@end - @start) + 1)
/* Error Condition */
if @min_exec = 2147483647
select @min_exec = 0
/* */
/* Write to the multi_results table */
/* */
insert into multi_results
select @multi_number,@iterate,@errs,@tot_exec,@min_exec,@max_exec,
@avg_exec,@elapsed,@tot_under1,@tot_under2
go