jimmykilleen
10 years agoNew Contributor
Output the VBScript Unit Name to File
I am currently writing a VBScript function that outputs the CPU% & Memory Usage of two applications that run simultaneously. I have achieved this & I get the data to in csv format.
I have a set of VB Scripts that run as part of my project & I have amended them to call the function above in order to output the CPU & Memory Usage.
What I want to achieve is that when my function is called, I can also output the Script Unit name (or even better the actual sub routine within the script that has been run). This will then allow me to accurately monitor individual areas of my applications for any possible memory leaks etc. Any Ideas?? Below is my code so far.
Sub CPU_Mem_Usage
'This routine will monitor the CPU & the Mem Usage & outputs the result to a CSV file with the build version as the file name.
Dim sPath
sPath = "\\Ulysses2008\TestComplete\FutaTill\TestProject_FT\Results\FutaTill_CPU_Mem_Stats_"&_
Sys.Process("FutaTill").FileVersionInfo & ".csv"
If Not aqFile.Exists(sPath) Then
Call aqFile.Create(sPath)
Call aqFile.WriteToTextFile(sPath, "CPU & Memory Usage Statistics for FutaTill Build Version " &_
Sys.Process("FutaTill").FileVersionInfo & vbCrlf , aqFile.ctANSI, False)
Call aqFile.WriteToTextFile(sPath, "Test Date & Time: " & aqDateTime.Now & vbCrlf , aqFile.ctANSI, False)
Call aqFile.WriteToTextFile(sPath, "FutaTill, CPU (%), Mem Usage (K),, WinEpos, CPU (%), Mem Usage (K)" &_
vbCrlf , aqFile.ctANSI, False)
End If
Call aqFile.WriteToTextFile(sPath, "," & Sys.Process("FutaTill").CPUUsage & "," & Sys.Process("FutaTill").MemUsage &_
"," & ",," & Sys.Process("wineposv4").CPUUsage & "," & Sys.Process("wineposv4").MemUsage & vbCrlf , aqFile.ctANSI, False)
End Sub
I have a set of VB Scripts that run as part of my project & I have amended them to call the function above in order to output the CPU & Memory Usage.
What I want to achieve is that when my function is called, I can also output the Script Unit name (or even better the actual sub routine within the script that has been run). This will then allow me to accurately monitor individual areas of my applications for any possible memory leaks etc. Any Ideas?? Below is my code so far.
Sub CPU_Mem_Usage
'This routine will monitor the CPU & the Mem Usage & outputs the result to a CSV file with the build version as the file name.
Dim sPath
sPath = "\\Ulysses2008\TestComplete\FutaTill\TestProject_FT\Results\FutaTill_CPU_Mem_Stats_"&_
Sys.Process("FutaTill").FileVersionInfo & ".csv"
If Not aqFile.Exists(sPath) Then
Call aqFile.Create(sPath)
Call aqFile.WriteToTextFile(sPath, "CPU & Memory Usage Statistics for FutaTill Build Version " &_
Sys.Process("FutaTill").FileVersionInfo & vbCrlf , aqFile.ctANSI, False)
Call aqFile.WriteToTextFile(sPath, "Test Date & Time: " & aqDateTime.Now & vbCrlf , aqFile.ctANSI, False)
Call aqFile.WriteToTextFile(sPath, "FutaTill, CPU (%), Mem Usage (K),, WinEpos, CPU (%), Mem Usage (K)" &_
vbCrlf , aqFile.ctANSI, False)
End If
Call aqFile.WriteToTextFile(sPath, "," & Sys.Process("FutaTill").CPUUsage & "," & Sys.Process("FutaTill").MemUsage &_
"," & ",," & Sys.Process("wineposv4").CPUUsage & "," & Sys.Process("wineposv4").MemUsage & vbCrlf , aqFile.ctANSI, False)
End Sub