# Environment & Runtime
The `System.Info` unit provides access to the host environment, hardware specifications, and system-level metrics. It is essential for writing environment-aware scripts and performance profiling.
## Application Environment
The `ApplicationInfo` object provides details about the running process.
```pascal
// NO_RUN
PrintLn('User: ' + ApplicationInfo.UserName);
PrintLn('Directory: ' + ApplicationInfo.CurrentDirectory);
// Check if running in a debugger
if ApplicationInfo.IsDebuggerPresent then
PrintLn('Debugging mode active');
```
## Hardware & OS
You can query the CPU model, core count, and operating system details.
```pascal
// NO_RUN
PrintLn('OS: ' + OSVersionInfo.Name + ' (' + OSVersionInfo.Version + ')');
PrintLn('CPU: ' + CPUInfo.Name);
PrintLn('Cores: ' + IntToStr(CPUInfo.Count));
// Monitor CPU usage
PrintLn('Global CPU Usage: ' + FloatToStr(CPUInfo.SystemUsage) + '%');
PrintLn('Process CPU Usage: ' + FloatToStr(CPUInfo.ProcessUsage) + '%');
```
## Memory Monitoring
To check memory usage, instantiate the `MemoryStatus` class.
```pascal
// NO_RUN
var mem := new MemoryStatus;
var freeMB := mem.Physical.Available div (1024 * 1024);
PrintLn('Available Physical Memory: ' + IntToStr(freeMB) + ' MiB');
var counters := ApplicationInfo.MemoryCounters();
PrintLn('Process Working Set: ' + IntToStr(counters.WorkingSetSize div 1024) + ' KiB');
```
## Performance Profiling
The `PerformanceCounter` class provides a high-resolution timer for measuring the execution time of code blocks.
```pascal
var pc := new PerformanceCounter;
// Simulate work
Sleep(150);
pc.Stop;
PrintLn(Format('Task completed in %.3f seconds', [pc.Elapsed]));
// OUTPUT
// Task completed in 0.151 seconds
```
:::info
### Detailed Reference
For a complete list of all classes, properties, and records available in the system info unit, see the API reference:
* **[System Info API Reference](/ref/systeminfo)**
:::
Environment & Runtime
The System.Info unit provides access to the host environment, hardware specifications, and system-level metrics. It is essential for writing environment-aware scripts and performance profiling.
Application Environment
The ApplicationInfo object provides details about the running process.
// NO_RUN
PrintLn('User: '+ ApplicationInfo.UserName);
PrintLn('Directory: '+ ApplicationInfo.CurrentDirectory);// Check if running in a debuggerif ApplicationInfo.IsDebuggerPresent then
PrintLn('Debugging mode active');
Hardware & OS
You can query the CPU model, core count, and operating system details.
// NO_RUN
PrintLn('OS: '+ OSVersionInfo.Name +' ('+ OSVersionInfo.Version +')');
PrintLn('CPU: '+ CPUInfo.Name);
PrintLn('Cores: '+ IntToStr(CPUInfo.Count));// Monitor CPU usage
PrintLn('Global CPU Usage: '+ FloatToStr(CPUInfo.SystemUsage)+'%');
PrintLn('Process CPU Usage: '+ FloatToStr(CPUInfo.ProcessUsage)+'%');
Memory Monitoring
To check memory usage, instantiate the MemoryStatus class.