Tokay Posted February 14, 2021 Share Posted February 14, 2021 The UniServerInstance.ServerResources.MemoryUsed always returns zero. It's obviously wrong value. I'm use latest, 1545, version. Link to comment Share on other sites More sharing options...
Tokay Posted February 18, 2021 Author Share Posted February 18, 2021 Up Link to comment Share on other sites More sharing options...
Tokay Posted May 16, 2021 Author Share Posted May 16, 2021 up Link to comment Share on other sites More sharing options...
Tokay Posted July 2, 2021 Author Share Posted July 2, 2021 up Link to comment Share on other sites More sharing options...
Tokay Posted July 4, 2021 Author Share Posted July 4, 2021 In the last 1550 version isssue does not fixed. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted July 6, 2021 Administrators Share Posted July 6, 2021 Hello, Linux or Windows? Link to comment Share on other sites More sharing options...
Tokay Posted July 6, 2021 Author Share Posted July 6, 2021 Windows, XE6. Link to comment Share on other sites More sharing options...
Tokay Posted November 10, 2021 Author Share Posted November 10, 2021 Hi. Does this feature fixed in the latest, 1555, version? Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 11, 2021 Administrators Share Posted November 11, 2021 Hello, Is the value correct in server control panel? Link to comment Share on other sites More sharing options...
Pep Posted November 11, 2021 Share Posted November 11, 2021 Hello Tokay, I'm in last version: 1.90.0 build 1555 and "UniServerInstance.ServerResources.MemoryUsed" returns a value. In my case this value is the exactly same that returns this function to caculate the memory used by a Delphi App (I get it from stackoverflow) uses FastMM4; //include this or method will return 0. function GetMemoryUsed: UInt64; var st: TMemoryManagerState; sb: TSmallBlockTypeState; begin GetMemoryManagerState(st); result := st.TotalAllocatedMediumBlockSize + + st.TotalAllocatedLargeBlockSize; for sb in st.SmallBlockTypeStates do begin result := result + sb.UseableBlockSize * sb.AllocatedBlockCount; end; end; Note: My Delphi Version is 10.4.2 1 Link to comment Share on other sites More sharing options...
Tokay Posted November 11, 2021 Author Share Posted November 11, 2021 3 hours ago, Farshad Mohajeri said: Hello, Is the value correct in server control panel? Hello. No, there are also zeros in this form: Link to comment Share on other sites More sharing options...
Tokay Posted November 11, 2021 Author Share Posted November 11, 2021 Also uptime is missing in my app: There is one peculiarity. My app works as a service. Maybe it prevent the proper calculations. I've started the standalone demo app, and memory size and uptime calculated fine in it. Link to comment Share on other sites More sharing options...
Tokay Posted November 15, 2021 Author Share Posted November 15, 2021 I've found what happend with memory calculation. When I added the FastMM4 module to the code, memory does not calculated. I could not found the reason couses of absent sources (UniGUIServer.pas). I've used the FastMM4AVX from here: https://github.com/maximmasiutin/FastMM4-AVX It's commonly used free module. Here is the test project, both issues (memory used and uptime) is present in it: test16.7z Please analyze and fix the issues! Thank you! 1 Link to comment Share on other sites More sharing options...
x11 Posted November 16, 2021 Share Posted November 16, 2021 UniServerInstance.ServerResources.ProcessMemoryUsed returns 73342976. I have no use FastMM. Link to comment Share on other sites More sharing options...
x11 Posted November 16, 2021 Share Posted November 16, 2021 I connect FastMM5.pas to dpr-file. UniServerInstance.ServerResources.ProcessMemoryUsed returns 73342976. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 17, 2021 Administrators Share Posted November 17, 2021 program Project1; uses FastMM4, uniWinUtils, Forms, ServerModule in 'ServerModule.pas' {UniServerModule: TUniGUIServerModule}, MainModule in 'MainModule.pas' {UniMainModule: TUniGUIMainModule}, Main in 'Main.pas' {MainForm: TUniForm}, ServiceModule in 'ServiceModule.pas' {UniServiceModule: TUniGUIService}, Unit37 in 'Unit37.pas'; {$R *.res} function GetMemoryUsed: Int64; var st: TMemoryManagerState; sb: TSmallBlockTypeState; begin FastMM4.GetMemoryManagerState(st); result := st.TotalAllocatedMediumBlockSize + st.TotalAllocatedLargeBlockSize; for sb in st.SmallBlockTypeStates do begin result := result + Int64(sb.UseableBlockSize) * sb.AllocatedBlockCount; end; end; begin PGetMemoryUsedProc := GetMemoryUsed; Application.Initialize; TUniServerModule.Create(Application); Application.Run; end. Here is the solution. However, it will only work in next build! 1 1 Link to comment Share on other sites More sharing options...
Tokay Posted November 17, 2021 Author Share Posted November 17, 2021 Great! Thank you! I'll waiting for build. And please look at the uptime calculation. Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted November 18, 2021 Administrators Share Posted November 18, 2021 If you check the control panel the /server url it will show the correct uptime. You are trying to create the server panel form manually. It doesn't initialize the form correctly. I will include an example showing how to create a custom server statistics page. 1 Link to comment Share on other sites More sharing options...
Tokay Posted November 18, 2021 Author Share Posted November 18, 2021 I have to use manually created form because I need it translation. If it possible to translate form from the /server url, then it will be a solution. Link to comment Share on other sites More sharing options...
Tokay Posted December 19, 2021 Author Share Posted December 19, 2021 I update to the last 1566 version and all works fine here: uptime (for now only in /server, but I added own realization) and memory calculation (without code changing). Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now