Jump to content

Memory logging


Recommended Posts

As relative beginner with AutoIT I got stuk with memory logging. I have created a script that starts some applications, runs some tests in these applications and then stops the applications. This procedure is cycled. Now I like to log the memory usage of these processes each cycle.

I found the function MemGetStats but don't know how to use it for logging the individual  processes. Who can help me further with this?

Link to comment
Share on other sites

as you can see by the example for MemGetStats, it writes the output to a msgbox.

#include <MsgBoxConstants.au3>
Local $aMem = MemGetStats()
MsgBox($MB_SYSTEMMODAL, "", "Total physical RAM (KB): " & $aMem[1])

instead of writing the output to a msgbox, write the output to a file using FileWrite. Look at the example and you will see how it is done.

Edited by Bert
clarity
Link to comment
Share on other sites

...how to use it for logging the individual  processes.​

It doesn't appear that MemGetStats allows you to collect stats for any particular process(es).  Check out _WinAPI_GetProcessMemoryInfo in the help file.

Link to comment
Share on other sites

Here is a piece of code, how I got it working:

local $aMemory = ProcessGetStats("FlucamViewer.exe")
        ConsoleWrite("Flucam_1 ; " & $aMemory[0] & " ;  " & "Flucam_2  ;" & $aMemory[1] & @CR)

    Local $aMem = MemGetStats()
    ConsoleWrite ("Memory load and physical RAM" & @CR & $aMem[0] & "; " & $aMem[2] & @CR)
    FileWriteLine($logFile_memtest, @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC & " : " & $aMem[0] & "  ;  " & $aMem[2] & "Memory load and physical RAM (" & $nrRestarts & ")")

Link to comment
Share on other sites

  • Moderators

Bert,

Where has your Google-Fu gone? FlucamViewer is used by those who have to deal with scanning electron microscopes - nothing untoward at all.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...