home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / tool / various / hitime / htsample.frm < prev    next >
Text File  |  1995-02-27  |  4KB  |  163 lines

  1. VERSION 2.00
  2. Begin Form HTSAMPLE 
  3.    Caption         =   "HiTime Sample"
  4.    ClientHeight    =   3150
  5.    ClientLeft      =   1260
  6.    ClientTop       =   1605
  7.    ClientWidth     =   4245
  8.    Height          =   3675
  9.    Left            =   1200
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3150
  12.    ScaleWidth      =   4245
  13.    Top             =   1140
  14.    Width           =   4365
  15.    Begin HScrollBar HScroll1 
  16.       Height          =   255
  17.       LargeChange     =   25
  18.       Left            =   240
  19.       Max             =   1000
  20.       Min             =   10
  21.       TabIndex        =   0
  22.       Top             =   1680
  23.       Value           =   10
  24.       Width           =   1335
  25.    End
  26.    Begin Timer Timer1 
  27.       Interval        =   1000
  28.       Left            =   3480
  29.       Top             =   240
  30.    End
  31.    Begin MabryHiTime HiTime1 
  32.       Interval        =   0
  33.       Left            =   3000
  34.       Top             =   240
  35.    End
  36.    Begin Label txtATPS 
  37.       Alignment       =   1  'Right Justify
  38.       Height          =   255
  39.       Left            =   2760
  40.       TabIndex        =   9
  41.       Top             =   2640
  42.       Width           =   1215
  43.    End
  44.    Begin Label txtTLS 
  45.       Alignment       =   1  'Right Justify
  46.       Height          =   255
  47.       Left            =   2760
  48.       TabIndex        =   8
  49.       Top             =   2400
  50.       Width           =   1215
  51.    End
  52.    Begin Label txtTT 
  53.       Alignment       =   1  'Right Justify
  54.       Height          =   255
  55.       Left            =   2760
  56.       TabIndex        =   7
  57.       Top             =   2160
  58.       Width           =   1215
  59.    End
  60.    Begin Label Label6 
  61.       Caption         =   "Average Ticks Per Second:"
  62.       Height          =   255
  63.       Left            =   240
  64.       TabIndex        =   6
  65.       Top             =   2640
  66.       Width           =   2655
  67.    End
  68.    Begin Label Label5 
  69.       Caption         =   "Ticks Last Second:"
  70.       Height          =   255
  71.       Left            =   240
  72.       TabIndex        =   5
  73.       Top             =   2400
  74.       Width           =   2295
  75.    End
  76.    Begin Label Label4 
  77.       Caption         =   "Total Ticks:"
  78.       Height          =   255
  79.       Left            =   240
  80.       TabIndex        =   4
  81.       Top             =   2160
  82.       Width           =   2295
  83.    End
  84.    Begin Label Label3 
  85.       Caption         =   "Play with the scroll bar and see how your machine handles smaller and larger intervals."
  86.       Height          =   735
  87.       Left            =   240
  88.       TabIndex        =   3
  89.       Top             =   840
  90.       Width           =   3735
  91.    End
  92.    Begin Label Label2 
  93.       Caption         =   "Interval = 10"
  94.       Height          =   255
  95.       Left            =   1680
  96.       TabIndex        =   2
  97.       Top             =   1680
  98.       Width           =   2295
  99.    End
  100.    Begin Label Label1 
  101.       Caption         =   "HiTime Sample"
  102.       FontBold        =   -1  'True
  103.       FontItalic      =   0   'False
  104.       FontName        =   "MS Sans Serif"
  105.       FontSize        =   13.5
  106.       FontStrikethru  =   0   'False
  107.       FontUnderline   =   0   'False
  108.       Height          =   375
  109.       Left            =   240
  110.       TabIndex        =   1
  111.       Top             =   240
  112.       Width           =   2535
  113.    End
  114. End
  115. Option Explicit
  116.  
  117. Dim nTicksThisSecond As Long
  118. Dim nTotalTicks As Long
  119. Dim nTotalSeconds As Long
  120.  
  121. Sub Form_Load ()
  122.     Call HScroll1_Scroll
  123. End Sub
  124.  
  125. Sub HiTime1_Timer ()
  126.     nTicksThisSecond = nTicksThisSecond + 1
  127. End Sub
  128.  
  129. Sub HScroll1_Change ()
  130.     Call HScroll1_Scroll
  131. End Sub
  132.  
  133. Sub HScroll1_Scroll ()
  134.     HiTime1.Interval = HScroll1.Value
  135.     Label2.Caption = "Interval = " & Format$(HScroll1.Value)
  136.     nTicksThisSecond = 0
  137.     nTotalTicks = 0
  138.     nTotalSeconds = 0
  139.  
  140.     Call UpdateLabels
  141. End Sub
  142.  
  143. Sub Timer1_Timer ()
  144.     nTotalTicks = nTotalTicks + nTicksThisSecond
  145.     nTotalSeconds = nTotalSeconds + 1
  146.  
  147.     Call UpdateLabels
  148.  
  149.     nTicksThisSecond = 0
  150. End Sub
  151.  
  152. Sub UpdateLabels ()
  153.     txtTT = Format$(nTotalTicks)
  154.     txtTLS = Format$(nTicksThisSecond)
  155.  
  156.     If nTotalSeconds = 0 Then
  157.         txtATPS = "0.0"
  158.     Else
  159.         txtATPS = Format$(nTotalTicks / nTotalSeconds, "0.0")
  160.     End If
  161. End Sub
  162.  
  163.