Physical memory calculation


 
Thread Tools Search this Thread
Operating Systems Solaris Physical memory calculation
# 1  
Old 03-13-2014
Physical memory calculation

Below is Physical Memory result :

Code:
-bash-3.00$ prtconf | grep "Memory size"
Memory size: 36854 Megabytes
-bash-3.00$ vmstat 1 2 | tail -1
 0 0 0 28220616 1318888 15 143 0 0 0  0  0 253 2 15  0 5215 14989 5917 7  0 93

and the script i have to calculate this in Percentage is :
Code:
#!/bin/sh
totalmb=`/usr/sbin/prtconf | grep "Memory size" | awk '{print $3}'`
freemb=`vmstat 1 2 | tail -1 | awk '{print $5/1024}'`
usedmb=`/usr/bin/echo $totalmb-$freemb|/usr/bin/bc`
percentage=`echo $usedmb*100/$totalmb | bc`
echo "Percentage="$percentage"%"

Code:
-bash-3.00$ sh PhysicalMemory.sh
Percentage=96%

Can you please help me to know whether the script i am using is really showing UsedPhysicalMemory in Percentage?


Or may i have one single cmd line to see the Used/Free Physical Memory in Solaris?
Code:
-bash-3.00$ uname -a
SunOS localhost 5.10 Generic_142910-17 i86pc i386 i86pc

As customer is showing result in :

Code:
 [oracle@xxxx]/u02/app/oracle>prstat -a
     PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP
  18767 oracle     10G  770M cpu11    0    0   0:03:05 4.2% oracle/1
    1242 oracle     10G 9174M sleep   57    0  89:11:01 0.2% oracle/1
  12736 oracle     10G 8571M sleep   59    0  26:05:19 0.1% oracle/1
  12748 oracle     10G 8558M sleep   59    0  26:00:07 0.1% oracle/1
  12734 oracle     10G 8574M sleep   59    0  25:58:11 0.1% oracle/1
  12744 oracle     10G 8566M sleep   59    0  26:05:31 0.1% oracle/1
  12742 oracle     10G 8561M sleep   59    0  25:49:25 0.1% oracle/1
    2952 oracle     10G   48M sleep   59    0  41:33:08 0.0% oracle/2
    2848 root     1183M  333M sleep   59    0  59:51:40 0.0% crsd.bin/47
    2200 root      138M   24M sleep   59    0  76:02:33 0.0% orarootagent.bi/25
    2220 root       85M   33M sleep  159    -  37:14:53 0.0% osysmond.bin/11
    2936 oracle     10G 5195M cpu1   101    -  11:26:20 0.0% oracle/1
    2932 oracle     10G 5193M sleep  101    -  11:29:55 0.0% oracle/1
    2246 oracle    122M   56M sleep  100    -  50:10:03 0.0% ocssd.bin/34
  22762 oracle    120M   42M sleep   59    0  23:11:09 0.0% oraagent.bin/23
    2806 oracle    503M   58M sleep   59    0  16:32:58 0.0% oracle/1
    2980 root       92M   24M sleep   59    0  38:27:58 0.0% orarootagent.bi/11
  18900 oracle     10G 8338M sleep   59    0   0:49:59 0.0% oracle/1
  18894 oracle     10G 8336M sleep   59    0   0:49:49 0.0% oracle/1
  18898 oracle     10G 8347M sleep   59    0   0:49:43 0.0% oracle/1
    2926 oracle     10G   66M sleep   59    0  12:22:57 0.0% oracle/1
  18880 oracle     10G 8350M sleep   59    0   0:50:12 0.0% oracle/1
    2199 oracle     86M   19M sleep   59    0  26:51:28 0.0% gipcd.bin/10
  18972 oracle     10G   37M sleep   59    0   0:00:00 0.0% oracle/1
  18141 oracle     10G  157M sleep   59    0   0:00:01 0.0% oracle/1
  18110 oracle     10G  221M sleep   59    0   0:00:01 0.0% oracle/2
  18890 oracle     10G 8337M sleep   59    0   0:49:49 0.0% oracle/1
  18904 oracle     10G 8335M sleep   59    0   0:50:00 0.0% oracle/1
  18968 oracle     10G   37M sleep   59    0   0:00:00 0.0% oracle/1
  18137 oracle     10G  160M sleep   59    0   0:00:01 0.0% oracle/1
  NPROC USERNAME  SWAP   RSS MEMORYTIME  CPU
     497 oracle     14G   12G    33%553:54:21 5.2%
      48 root     2703M  600M   1.6%292:55:12 0.1%
       4 gnocadmi 3244K 6360K   0.0%   0:00:07 0.0%
       1 noaccess   99M   43M   0.1%   2:30:40 0.0%
       5 hpsmh      16M 2608K   0.0%   0:00:00 0.0%
       1 smmsp    1772K 3164K   0.0%   0:00:57 0.0%
       1 daemon   1404K 4156K   0.0%   0:40:32 0.0%



Customer Saying Physical Memory used is max 35 % Used, but from the logic i am calculating its 96% Used

Last edited by Franklin52; 03-13-2014 at 04:09 AM.. Reason: Please use code tags
# 2  
Old 03-13-2014
You aren't measuring the same thing. You customer is only looking to RAM used by processes in the current zone, while your command is not detailed enough to figure out what is using the RAM.

To have a clearer view about how the RAM is used, run this command from the global zone:

Code:
echo ::memstat | mdb -k

This User Gave Thanks to jlliagre For This Post:
# 3  
Old 03-14-2014
Thanks, But wanted to know does my code shared giving idea that this total amount of Physical memory is being used?
# 4  
Old 03-14-2014
That depends on how you define used memory. If you use ZFS, file system cache memory will be reported as used by your command but if you use UFS, it won't. You really should run the command I suggested and post its output to figure it out.
This User Gave Thanks to jlliagre For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Physical Memory expansion

IBM says we cannot expand our physical memory on our 570's without upgrading all the existing DIMMS since all slots are currently full. Is it really so difficult for IBM to build servers that leave a couple vacant slots for future expansion? A technical explanation would be greatly appreciated.... (2 Replies)
Discussion started by: 1computerman
2 Replies

2. Shell Programming and Scripting

Memory Calculation

Hi, I want an script that calculate total memory consume by all Oracle Process 6689 oraprod 16 0 1163m 155m 150m S 0 2.0 0:01.95 oracle 7046 oraprod 16 0 1161m 18m 14m S 0 0.2 0:00.02 oracle 7392 oraprod 16 0 1165m 39m 33m S 0 0.5 0:00.07 oracle 7394 oraprod 16 0 1161m 22m 18m S... (1 Reply)
Discussion started by: telnor
1 Replies

3. Solaris

restrcit physical memory with zone.max-locked-memory

Is it possible to restrict physical memory in solaris zone with zone.max-locked-memory just like we can do with rcapd ? I do not want to used rcapd (1 Reply)
Discussion started by: fugitive
1 Replies

4. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

5. Solaris

physical memory

what is the command to find the physical memory in soalris OS and how to find whether paging is happening or not ? (2 Replies)
Discussion started by: jayaramanit
2 Replies

6. Linux

memory calculation

hi all, sorry for silly question. but i have a doubt in calculation of memory utilization calculation. using 'free' command we calculate the memory utilization as used/total. but my friend said that its wrong and we have to include cached also as (used-cached)/memory. but these... (0 Replies)
Discussion started by: rrlog
0 Replies

7. Solaris

How to check physical memory

HI Please help me how to check the physical memory, model name and hardisk information. (5 Replies)
Discussion started by: jeelans
5 Replies

8. Shell Programming and Scripting

get physical and virtual memory

What command can i use to get the physical and virtual memory of a database? (7 Replies)
Discussion started by: tads98
7 Replies

9. UNIX for Dummies Questions & Answers

physical memory

It is just a general question....is there a limit on the memory? I am looking into a process to store image files on the unix server which will be accessed by the application, and I just wonder if there is any limit regarding the physical or virtual memory. I am very new to unix, so thanks for... (1 Reply)
Discussion started by: cchien
1 Replies

10. Programming

Physical Memory

Hi, My problem is next.... How can I work with physical memory in the Unix FreeBSD 2.2 or hight? What is the "mem" & "kmem" drivers? P.S./ writing device driver for UNIX FreeBSD 2.2 :D (2 Replies)
Discussion started by: Alex_T
2 Replies
Login or Register to Ask a Question