home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / TRACK.ZIP / MULTIUSR.SQL < prev    next >
Text File  |  1989-05-17  |  2KB  |  73 lines

  1. /* */
  2. /* These procedures calculate the results information  */
  3. /* */
  4.  
  5. use bench_stat
  6. go
  7.  
  8. drop procedure tp_comp_multiuser
  9. go
  10.  
  11. create procedure tp_comp_multiuser @multi_number int, @start int, @end int as
  12.  
  13. declare @errs int, @max_exec int, @min_exec int, @avg_exec float, 
  14. @tot_exec int, @loopcnt int, @iterate int, @outline varchar(255), 
  15. @elapsed int, @tmp int, @tmp1 float, @sdate datetime, @edate datetime, 
  16. @tot_avg_exec float, @tot_under1 int, @tot_under2 int
  17.  
  18. select @loopcnt = @start
  19. select @max_exec = 0
  20. select @min_exec = 2147483647
  21. select @tot_exec = 0
  22. select @tot_avg_exec = 0.0
  23. select @iterate = 0
  24. select @errs = 0
  25. select @elapsed = 0
  26. select @tot_under1 = 0
  27. select @tot_under2 = 0
  28.  
  29. /* Get the raw totals */
  30.  
  31. while @loopcnt <= @end
  32. BEGIN
  33.  
  34.  select @errs = @errs + (select errors from runs where number = @loopcnt)
  35.  
  36.  select @tmp =  max_exec from runs where number = @loopcnt
  37.  if @tmp >= @max_exec
  38.     select @max_exec = @tmp
  39.  select @tmp =  min_exec from runs where number = @loopcnt
  40.  if @tmp <= @min_exec
  41.     select @min_exec = @tmp
  42.  
  43.  select @tot_exec = @tot_exec + (select tot_exec from runs where number = @loopcnt)
  44.  select @tot_avg_exec = @tot_avg_exec + (select avg_exec from runs where number = @loopcnt)
  45.  select @iterate = @iterate + (select iterations from runs where number = @loopcnt)
  46.  select @sdate = start_time from runs where number = @loopcnt
  47.  select @edate = end_time from runs where number = @loopcnt
  48.  select @tmp = datediff(second,@sdate,@edate)
  49.  select @elapsed = @elapsed + @tmp
  50.  select @tot_under1 = @tot_under1 + (select under1_exec from runs where number = @loopcnt)
  51.  select @tot_under2 = @tot_under2 + (select under2_exec from runs where number = @loopcnt)
  52.  select @loopcnt = @loopcnt + 1
  53.  
  54. END
  55.  
  56. /* Calculate average exec time */
  57.  
  58. select @avg_exec = @tot_avg_exec/((@end - @start) + 1) 
  59.  
  60. /* Error Condition */
  61.  
  62. if @min_exec = 2147483647
  63.   select @min_exec = 0
  64.  
  65. /* */
  66. /* Write to the multi_results table */
  67. /* */
  68.  
  69. insert into multi_results
  70. select @multi_number,@iterate,@errs,@tot_exec,@min_exec,@max_exec,
  71.        @avg_exec,@elapsed,@tot_under1,@tot_under2
  72. go
  73.