memory free pct ?
Posted in 2012
Topics: Internationalization & Character Sets
Hi, have found this query for get the IDS free memory, first 2 terms shows ok, but i tried to add the third, i want the PCT (%) of free memory, but shows bad number: SELECT format_units(sum(seg_size)) as ifx_memory_allocated, format_units(sum(seg_blkfree),4) as ifx_memory_free, (sum(seg_blkfree) * 100) / sum(seg_size) as pct_free FROM sysmaster:sysseglst What is wrong ? example: ifx_memory_allocated ifx_memory_free pct_free 11.0 GB 4.37 GB 0.0097323743318829246144932703449505
Try this one: SELECT format_units(sum(seg_size)) as ifx_memory_allocated, format_units(sum(seg_blkfree * 4096),4) as ifx_memory_free, (100 * sum(seg_blkfree)) / sum((seg_blkused + seg_blkfree)) as pct_free FROM sysmaster:sysseglst; Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Mon, Oct 29, 2012 at 3:06 PM, eferreyra <eferreyra@gmail.com> wrote: > Hi, have found this query for get the IDS free memory, first 2 terms shows > ok, but i tried to add the third, i want the PCT (%) of free memory, but > shows bad number: > > SELECT format_units(sum(seg_size)) as ifx_memory_allocated, > format_units(sum(seg_blkfree),4) as ifx_memory_free, > (sum(seg_blkfree) * 100) / sum(seg_size) as pct_free > FROM sysmaster:sysseglst > > What is wrong ? > > example: > ifx_memory_allocated ifx_memory_free pct_free > 11.0 GB 4.37 GB > 0.0097323743318829246144932703449505 > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list >
Hi Art, it didnt returned the second correct value correct: 272 MB 254 GB 23.32802204900736402394384393437 Anyway 4096 its the number i was missing in my query, can i get it form sysmaster too ? The only 4096 i can find is os_pagesize in sysmachines table. This is my current full statement then, gives correct values for your system ? SELECT format_units(sum(seg_size)) as ifx_memory_allocated, format_units(sum(seg_blkused),4) as ifx_memory_used, format_units(sum(seg_blkfree),4) as ifx_memory_free, format_units(sum(os_mem_total)) as os_memory_total, format_units(sum(os_mem_free)) as os_memory_free, (((sum(seg_blkfree)/sum(seg_size)) * min(os_pagesize)) * 100) as ifx_free_pct, ((sum(os_mem_free)/sum(os_mem_total)) * 100) as os_free_pct from sysmaster:sysseglst, sysmaster:sysmachineinfo;
Hi, Your numbers look ok, only because you are on a 4k page size operating system, and one memory block is always 4k. I use this to calculate free percent: seg_blkfree/(seg_blkused+seg_blkfree)*100 I use this to determine the number of bytes in each block: seg_size/(seg_blkused+seg_blkfree) HTH, Jason