473,388 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Memory Used - in Solaris using C programming

How do I get the used-memory of a solaris running system using C code ?

Thanks!
Mar 5 '07 #1
4 4822
Could you refine the problem more ??

Thnkx !
Mar 5 '07 #2
drhowarddrfine
7,435 Expert 4TB
See if 'top' does what you want.
Mar 5 '07 #3
here is sample code to get memory information from solaris in C

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <unistd.h>
  3.  
  4. int main()
  5. {
  6.  
  7.    long numPages, pageSize, freePages, totalSize, totalUsed, totalFree;
  8.  
  9.    numPages = sysconf(_SC_PHYS_PAGES)/1024;
  10.    pageSize = sysconf(_SC_PAGESIZE)/1024;
  11.    freePages = sysconf( _SC_AVPHYS_PAGES)/1024;
  12.    totalSize = numPages * pageSize;
  13.    totalFree = pageSize * freePages;
  14.    totalUsed = totalSize - totalFree;
  15.  
  16.    printf("total memory == %u MB\n",totalSize);
  17.    printf("total free memory == %u MB\n",totalFree);
  18.    printf("total used memory == %u MB\n",totalUsed);
  19.  
  20.    return(0);
  21.  
  22. }
  23.  
  24.  
Mar 21 '07 #4
do u know the cpu utililization program in c for linux....
Apr 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Attila.Rajmund.Nohl | last post by:
Hello! I'm using KAI C++ Compiler (KCC) Version 4.0d on Sparc Solaris 8 with Sun WorkShop 6 update 2 backend (KCC compiles C++ code to C than uses the Sun compiler to produce machine...
3
by: Rekha | last post by:
Hello I am new to this group and also to the Shared Memory Programing on Solaris. I have written a class ShareMemoryManager to allocate space instead of calling new to allocate space dynamically....
3
by: wavelet | last post by:
a.exe is one programming writen with c/c++ language. a.exe will be called multi-times by another programming. Now I want to check how much memory is used by a.exe or whether some memory leak...
0
by: Erik Hendrix | last post by:
Hi, I was wondering if some people could help me here, I've been trying to use pmap on the DB2 processes to determine how much memory in total we are consuming for DB2 (shared + private). Now...
8
by: clsmyth | last post by:
Folks, Hi, I have never posted to a language group before so please excuse me if this is inappropriate. I have posted this to comp.unix.solaris (well, I am one of the folks on the thread at...
6
by: Jay | last post by:
I was wondering if there is any system call so that a process can access systems page table or swap pages from main memory by specifying the page number. I am trying to implement various page...
26
by: Bill Reid | last post by:
Bear with me, as I am not a "professional" programmer, but I was working on part of program that reads parts of four text files into a buffer which I re-allocate the size as I read each file. I...
5
by: Per B. Sederberg | last post by:
Hi Everybody: I'm having a difficult time figuring out a a memory use problem. I have a python program that makes use of numpy and also calls a small C module I wrote because part of the...
12
by: Tony | last post by:
Hi expert, I installed DB2 v8.2 server on Solaris 9 box. When I connect to DB2 using control centre or other applications(except command line), around 12 db2sysc processes pop up and each one...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.