75 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			75 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| Compile function OEngine_Services(@Service, @Params)
 | |
| #pragma precomp SRP_PreCompiler
 | |
| /***********************************************************************************************************************
 | |
| 
 | |
|     This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written
 | |
|     permission from Infineon Technologies.
 | |
| 
 | |
|     Name        :   OEngine_Services
 | |
| 
 | |
|     Description :   Handler program for all module related services.
 | |
| 
 | |
|     Notes       :   The generic parameters should contain all the necessary information to process the services. Often
 | |
|                     this will be information like the data Record and Key ID.
 | |
| 
 | |
|     Parameters  :
 | |
|         Service         [in] -- Name of the service being requested
 | |
|         Param1-10   [in/out] -- Additional request parameter holders
 | |
|         Response       [out] -- Response to be sent back to the Controller (MCP) or requesting procedure
 | |
| 
 | |
|     History     :   (Date, Initials, Notes)
 | |
|         10/11/23    djs     Original programmer.
 | |
| 
 | |
| ***********************************************************************************************************************/
 | |
| $Insert APP_INSERTS
 | |
| $Insert SERVICE_SETUP
 | |
| $Insert REVDOTNETEQUATES
 | |
| 
 | |
| Declare Function   GetCurrentProcessId, GetCommandLine
 | |
| Declare Subroutine Set_Property.Net, Mona_Services
 | |
| 
 | |
| GoToService else
 | |
|     Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.')
 | |
| end
 | |
| 
 | |
| Return Response or ""
 | |
| 
 | |
| //-----------------------------------------------------------------------------
 | |
| // SERVICES
 | |
| //-----------------------------------------------------------------------------
 | |
| 
 | |
| Service LogMemoryUsage()
 | |
|     
 | |
|     CmdLine           = GetCommandLine()
 | |
|     EngIndex          = Index(CmdLine, '/S=', 1)
 | |
|     EngNo             = CmdLine[EngIndex + 3, 'F ']
 | |
|     BaseGroupResource = 'GRP_OPENINSIGHT_MES_OP_FE_ENGINES_'
 | |
|     MonaResource      = BaseGroupResource:EngNo
 | |
|     ErrCode           = ''
 | |
|     Pid               = GetCurrentProcessId()
 | |
|     If Pid NE '' then
 | |
|         DotNetHandle = StartDotNet("","4.0")
 | |
|         DotNetDir    = CheckDotNet('4.0'):'\'
 | |
|         DirDllPath   = DotNetDir:'System.dll'
 | |
|         Set_Property.Net(DotNetHandle, "AssemblyName", DirDllPath)
 | |
|         If Not(Get_Status(errCode)) then
 | |
|             objProc = Create_Class.Net(DotNetHandle, "System.Diagnostics.Process", False$)
 | |
|             If Not(Get_status(errCode)) then
 | |
|                 Methods     = Get_Info.Net(objProc, REVDOTNET_INFO_METHODS)
 | |
|                 objThisProc = Send_Message.Net(objProc, "GetProcessById", Pid, 'System.Int32', True$)
 | |
|                 If Not(Get_Status(errCode)) then
 | |
|                     // Log memory values
 | |
|                     PeakWorkingSet = Get_Property.Net(objThisProc, 'PeakWorkingSet64', False$) / 1024
 | |
|                     WorkingSet     = Get_Property.Net(objThisProc, 'WorkingSet64', False$) / 1024
 | |
|                     Mona_Services('PostAverageMetric', MonaResource, 'PeakMemoryUsage', PeakWorkingSet)
 | |
|                     Mona_Services('PostAverageMetric', MonaResource, 'CurrentMemoryUsage', WorkingSet)
 | |
|                     Free_Class.Net(objThisProc)
 | |
|                 end
 | |
|                 Free_Class.Net(objProc)
 | |
|             end
 | |
|         end
 | |
|     end
 | |
|     
 | |
| End Service
 | |
| 
 |