Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

memory free pct ?

45 views
Skip to first unread message

eferreyra

unread,
Oct 29, 2012, 3:06:31 PM10/29/12
to
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

Art Kagel

unread,
Oct 29, 2012, 3:59:36 PM10/29/12
to eferreyra, inform...@iiug.org
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.



_______________________________________________
Informix-list mailing list
Inform...@iiug.org
http://www.iiug.org/mailman/listinfo/informix-list

eferreyra

unread,
Oct 30, 2012, 7:16:35 AM10/30/12
to eferreyra, inform...@iiug.org
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;


Jason Harris

unread,
Oct 31, 2012, 1:28:33 AM10/31/12
to eferreyra
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
0 new messages