86 lines
2.1 KiB
Markdown
86 lines
2.1 KiB
Markdown
|
|
||
|
# DWPRMON.CLS - Process Monitor Class Documentation
|
||
|
|
||
|
## Overview
|
||
|
DWPRMON.CLS provides process monitoring capabilities for DataWindow applications. It allows tracking and managing DataWindow processes during runtime.
|
||
|
|
||
|
## Class Properties
|
||
|
- `ProcessID` - Current process identifier
|
||
|
- `ProcessName` - Name of the monitored process
|
||
|
- `StartTime` - Process start timestamp
|
||
|
- `Status` - Current process status (Active/Inactive)
|
||
|
- `MemoryUsage` - Current memory consumption
|
||
|
- `CPUUsage` - CPU utilization percentage
|
||
|
|
||
|
## Methods
|
||
|
|
||
|
### Constructor
|
||
|
|
||
|
Constructor( as_processname )
|
||
|
|
||
|
Initializes a new process monitor instance
|
||
|
- Parameters:
|
||
|
- `as_processname`: String - Name of process to monitor
|
||
|
|
||
|
### StartMonitoring()
|
||
|
|
||
|
StartMonitoring()
|
||
|
|
||
|
Begins monitoring the specified process
|
||
|
- Returns: Boolean - True if monitoring started successfully
|
||
|
|
||
|
### StopMonitoring()
|
||
|
|
||
|
StopMonitoring()
|
||
|
|
||
|
Stops monitoring the current process
|
||
|
- Returns: Boolean - True if monitoring stopped successfully
|
||
|
|
||
|
### GetProcessMetrics()
|
||
|
|
||
|
GetProcessMetrics()
|
||
|
|
||
|
Retrieves current process performance metrics
|
||
|
- Returns: Structure containing:
|
||
|
- CPU usage
|
||
|
- Memory usage
|
||
|
- Thread count
|
||
|
- Handle count
|
||
|
|
||
|
### IsProcessActive()
|
||
|
|
||
|
IsProcessActive()
|
||
|
|
||
|
Checks if monitored process is still running
|
||
|
- Returns: Boolean - True if process is active
|
||
|
|
||
|
## Events
|
||
|
- `ProcessStarted` - Fired when monitoring begins
|
||
|
- `ProcessStopped` - Fired when monitoring ends
|
||
|
- `MetricsUpdated` - Fired when new metrics are collected
|
||
|
- `ThresholdExceeded` - Fired when resource usage exceeds defined limits
|
||
|
|
||
|
## Usage Example
|
||
|
|
||
|
// Create monitor instance
|
||
|
DWPRMON lw_monitor
|
||
|
lw_monitor = CREATE DWPRMON("myprocess")
|
||
|
|
||
|
// Start monitoring
|
||
|
lw_monitor.StartMonitoring()
|
||
|
|
||
|
// Check process status
|
||
|
IF lw_monitor.IsProcessActive() THEN
|
||
|
// Process metrics
|
||
|
lst_metrics = lw_monitor.GetProcessMetrics()
|
||
|
END IF
|
||
|
|
||
|
// Stop monitoring
|
||
|
lw_monitor.StopMonitoring()
|
||
|
|
||
|
|
||
|
## Notes
|
||
|
- Requires appropriate system permissions to monitor processes
|
||
|
- Recommended to properly dispose monitor instances when no longer needed
|
||
|
- Can be used to monitor multiple processes simultaneously using separate instances
|