Revise memory profiling implementation

- merge StopChanMemProf with StopMemoryProfiling
- remove fileMEM and stopMemProf from struct and constructors
- add separate mutex for memory profiling, ensure thread safety
- handle all significant errors
- log error if StopMemoryProfiling fails during CoreS Shutdown
- ignore errors if profiling inactive in Shutdown and deferred Stop
- move validations inside V1 functions
- return error if StartMemoryProfiling already started
- return error if StopMemoryProfiling already stopped or never started
- close profiling loop on error, not the cgr-engine
- StopMemoryProfiling closes channel and profiling loop writes final profile
- rename Path to DirPath for mandatory field error
- rename memprof_nrfiles flag to memprof_maxfiles
- increase default memprof_interval
- consider MaxFiles <= 0 as unlimited
- move memory profiling logic after starting services
- use CoreService Start/StopMemoryProfiling in main
- remove final memory profile block (created by deferred Stop)
- convert MemProfiling to method on CoreService and rename to profileMemory
- use Ticker for recurrent actions instead of Timer
- compute mem_final.prof full path in StartMemoryProfiling
- suffix profile files with current time instead of numbers
- update dispatcher methods after changes
- move MemoryPrf from utils to cores, rename to MemoryProfilingParams
- add logs for starting/stopping profiling
This commit is contained in:
ionutboangiu
2024-07-22 08:20:26 +03:00
committed by Dan Christian Bogos
parent 9d4561f79c
commit 1c490a9020
14 changed files with 271 additions and 239 deletions

View File

@@ -27,8 +27,8 @@ Able to read the configuration from either a local directory of *.json* files w
-memprof_dir string
Directory for memory profiles
-memprof_interval duration
Interval between memory profile saves (default 5s)
-memprof_nrfiles int
Interval between memory profile saves (default 15s)
-memprof_maxfiles int
Number of memory profiles to keep (most recent) (default 1)
-node_id string
Node ID of the engine
@@ -48,7 +48,6 @@ Able to read the configuration from either a local directory of *.json* files w
Print application version and exit
.. hint:: $ cgr-engine -config_path=/etc/cgrates
.. figure:: images/CGRateSInternalArchitecture.png