Jump to content

** MonMon ***


lsakizada
 Share

Recommended Posts

I have wrote this little handy qa tool for myself based on many other forum members codes.

The credit belongs to all.

The monitor has some uniqe features. Very useful for monitoring proccesses that living and dying many times....with same name.

It is working but after couple hours a memory leak occurs.

PLEASE HELP ON THIS MATTER TO CORRECT THE MEMORY LEAK. (Where it comes from????)

This process monitor has the following features:

1) Monitor single proccess.

2) Monitor Proccess name with different PID by giving the proccess name.

3) Monitor multiple proccess

4) Monitor multiple proccesses with different PIDs by reading proccess names from file that contain proccess name on each raw only.

5) Refresh the traytip report on specified interval time (in miliseconds)

6) Report to Monitor.txt logfile every specified interval of time (In seconds - minimum 60 seconds).

7) Create excel file for investigating the results.

8) The proccess name can be changed during run time to be monitored.

9) The tooltip can be set of during runl time.

Stopping the tool is by clicking on the 'ESC' keyboard button!

Download: Source code from the attached zip file

OOOPPPS: The files failed to be uploaded due to a large dll icons file.

I will post it without the graphicsicons.dll file. Change to different dll in the monmon.au3 file if you need it :

left button start the monitoring

Middle button open the logfile with notepad

Right icon create the excel file and open it

MonMon.zip

Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

I don't have all the includes can you compile it please.

All custom includes are in the zip file.

All others are part of the beta release.

The graphicsicons.dll is missing but it did not block from using it. Just pictures are not on buttons..as i mentioned it on first post.

Tell me what includes are missing when you run the monMon.au3 script with the beta.

I did not included exe on purpose

Edited by lsakizada

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

All custom includes are in the zip file.

All others are part of the beta release.

The graphicsicons.dll is missing but it did not block from using it. Just pictures are not on buttons..as i mentioned it on first post.

Tell me what includes are missing when you run the monMon.au3 script with the beta.

I did not included exe on purpose

timer.au3

Link to comment
Share on other sites

The following includes do not exist:

#include <SendMessage.au3>

#include <GuiButton.au3>

Spoiler

 

"If a vegetarian eats vegetables,What the heck does a humanitarian eat?"

"I hear voices in my head, but I ignore them and continue on killing."

"You have forced me to raise the indifference warning to beige, it's a beige alert people. As with all beige alerts please prepare to think about the possibility of caring."

An optimist says that giving someone power DOESN'T immediately turn them into a sadist. A pessimist says that giving someone power doesn't IMMEDIATELY turn them into a sadist.

 

 
Link to comment
Share on other sites

well , you seem upset that you don't got many replys and I am just saying this from my opinnion so no hard feelings.

If you are going to release something and expect people to try it you could may be at least include all the includes if you do not feel the need to compile so that we don't have to spend our time wandering around looking for the needle in the hay stack meaning the includes.

I am interested in your work but not if it means I got to go searching for missing files its sort of a turn off to the work you did and people will move on to different things.

I am still interested though :D

Link to comment
Share on other sites

Sorry, I thought all includes are in the beta directory except the files that I included.

I will attached the two that mentioned above include the exe file.

Dont run the exe if you do not trust me. I usually post the code only, never the binary.

Here they are, if still missing something then let me know.

MonMon.zip

Be Green Now or Never (BGNN)!

Link to comment
Share on other sites

Sorry, I thought all includes are in the beta directory except the files that I included.

I will attached the two that mentioned above include the exe file.

Dont run the exe if you do not trust me. I usually post the code only, never the binary.

Here they are, if still missing something then let me know.

nice it works great, I think I found a little problem though.

when I click on "read the log file"

notepad says the file "monitor.txt file doesn't exist and notepad ask me if I want to create the file.

something like that might fix it

If FileExists("Monitor.txt") Then
    ;do your function
Else
    MsgBox(0 , "" , "Monitor.txt doesn't exist...")
EndIf

Thanks for posting the compiled version of your code it works very well just missing the pictures but still works :)

Link to comment
Share on other sites

Thanks for posting the compiled version of your code it works very well just missing the pictures but still works :)

No it is not, it still have a memory leak that come from the WMI. I NEED HELP ON THIS ISSUE only then the program will be perfect.

I simplified the code to catch up the memory leak. It comes from the following code bellow.

I do not know how to solve the problem. please help, I need to use this tool as well.

#include <GUIConstants.au3>

HotKeySet("{Esc}", "HotKey")
While 1
    _ProcessListProperties()
WEnd

Func HotKey()
        Switch @HotKeyPressed
            Case  "{Esc}"
                exit
        EndSwitch
EndFunc  
Func _ProcessListProperties($Process = "", $sComputer = ".")
    Local $sUserName, $sMsg, $sUserDomain, $avProcs
    If $Process = "" Then
        $avProcs = ProcessList()
    Else
        $avProcs = ProcessList($Process)
    EndIf
    If $avProcs[0][0] = 0 Then Return $avProcs
    ReDim $avProcs[$avProcs[0][0] + 1][40]
    $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $sComputer & "\root\cimv2")
    If IsObj($oWMI) Then
        $colProcs = $oWMI.ExecQuery("select * from win32_process")
        If IsObj($colProcs) Then
            For $oProc In $colProcs
                For $n = 1 To $avProcs[0][0]
                    If $avProcs[$n][1] = $oProc.ProcessId Then
                        $avProcs[$n][2] = $oProc.ParentProcessId
                        If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName
                        $avProcs[$n][4] = $oProc.Priority
                        $avProcs[$n][5] = $oProc.ExecutablePath
                        $avProcs[$n][8] = $oProc.CommandLine
                        $avProcs[$n][9] = __StringToDate($oProc.CreationDate)
                        $avProcs[$n][10] = $oProc.Description
                        $avProcs[$n][11] = $oProc.ExecutionState
                        $avProcs[$n][12] = $oProc.Handle
                        $avProcs[$n][13] = $oProc.HandleCount
                        $avProcs[$n][14] = $oProc.KernelModeTime
                        $avProcs[$n][15] = $oProc.MaximumWorkingSetSize
                        $avProcs[$n][16] = $oProc.MinimumWorkingSetSize
                        $avProcs[$n][17] = $oProc.OSName
                        $avProcs[$n][18] = $oProc.OSCreationClassName
                        $avProcs[$n][19] = $oProc.OtherOperationCount
                        $avProcs[$n][20] = $oProc.OtherTransferCount
                        $avProcs[$n][21] = $oProc.PageFaults
                        $avProcs[$n][22] = $oProc.PageFileUsage
                        $avProcs[$n][23] = $oProc.PeakPageFileUsage
                        $avProcs[$n][24] = $oProc.PeakVirtualSize
                        $avProcs[$n][25] = $oProc.PrivatePageCount
                        $avProcs[$n][26] = $oProc.QuotaNonPagedPoolUsage
                        $avProcs[$n][27] = $oProc.QuotaPagedPoolUsage
                        $avProcs[$n][28] = $oProc.QuotaPeakNonPagedPoolUsage
                        $avProcs[$n][29] = $oProc.QuotaPeakPagedPoolUsage
                        $avProcs[$n][30] = $oProc.ReadOperationCount
                        $avProcs[$n][31] = $oProc.ReadTransferCount
                        $avProcs[$n][32] = $oProc.SessionId
                        $avProcs[$n][33] = $oProc.Status
                        $avProcs[$n][34] = $oProc.ThreadCount
                        $avProcs[$n][35] = $oProc.UserModeTime
                        $avProcs[$n][36] = $oProc.VirtualSize
                        $avProcs[$n][37] = $oProc.WindowsVersion
                        $avProcs[$n][38] = $oProc.WriteOperationCount
                        $avProcs[$n][39] = $oProc.WriteTransferCount
                        ExitLoop
                    EndIf
                Next
            Next
        Else
            SetError(2)
        EndIf
        Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher")
        $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet
        $oRefresher.Refresh
        Local $iTime = TimerInit()
        Do
            Sleep(10)
        Until TimerDiff($iTime) > 100
        $oRefresher.Refresh
        For $oProc In $colProcs
            For $n = 1 To $avProcs[0][0]
                If $avProcs[$n][1] = $oProc.IDProcess Then
                    $avProcs[$n][6] = $oProc.PercentProcessorTime
                    $avProcs[$n][7] = $oProc.WorkingSet
                    ExitLoop
                EndIf
            Next
        Next
    Else
        SetError(1)
    EndIf
    If IsObj($oWMI) Then
        $oWMI = ""
    EndIf
    
    If IsObj($oRefresher) Then
        $oRefresher = ""
    EndIf
    
    Return $avProcs
EndFunc  ;==>_ProcessListProperties

Func __StringToDate($dtmDate)
    Return (StringMid($dtmDate, 5, 2) & "/" & _
            StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) _
             & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2))
EndFunc  ;==>__StringToDate

Be Green Now or Never (BGNN)!

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...