C/C++ library for CPU statistics


 
Thread Tools Search this Thread
Top Forums Programming C/C++ library for CPU statistics
# 1  
Old 09-24-2008
Bug C/C++ library for CPU statistics

Hi all,

This is my first post, so at the beginning I would like to be nice and say: "Hello all!" Smilie
I am looking for a C/C++ library for Linux CPU statistics. All I found is that it is possible to parse two files: /proc/cpuinfo and /proc/stat to gain some needed information, but I would like to know if there is a nice library for doing this (ex. Solaris kstat.h equivalent).

Thanks is advace. Regards.
# 2  
Old 09-24-2008
I have found the kernel_stat.h library. There is a structure:

struct kernel_stat {
struct cpu_usage_stat {
unsigned int user;
unsigned int nice;
...
}
unsigned int irqs[NR_IRQS];
}


Can anyone tell me how to fill in this structure with data? Thanks in advance.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

CPU Usage statistics Dump in a text file over a period of time

I am facing issue related to performance of one customized application running on RHEL 5.9. The application stalls for some unknown reason that I need to track. For that I require some tool or shell scripts that can monitor the CPU usage statistics (what we get in TOP or in more detail by other... (6 Replies)
Discussion started by: Anjan Ganguly
6 Replies

2. UNIX for Dummies Questions & Answers

Is it possible to combine multiple CPU to act as a single CPU on the same server?

We have a single threaded application which is restricted by CPU usage even though there are multiple CPUs on the server, hence leading to significant performance issues. Is it possible to merge / combine multiple CPUs at OS level so it appear as a single CPU for the application? (6 Replies)
Discussion started by: Dissa
6 Replies

3. UNIX for Dummies Questions & Answers

CPU and Memory Statistics Collection Across Many Servers

Hello geeks once again, many thanks for help in times past, you guys are awesome! But am here again, but now this is way heavy for me. Find below for my challenge: *** I need to collect CPU & RAM stats across 26 servers. *** I don't have the luxury of deploying an NMS, if I had it would... (3 Replies)
Discussion started by: infinitydon
3 Replies

4. AIX

Add shared members from library to same library in a different directory

I'm trying to install libiconv to AIX 7.1 from an rpm off of the perzl site. The rpm appears to install but I get this error message. add shr4.o shared members from /usr/lib/libiconv.a to /opt/freeware/lib/libiconv.a add shr.o shared members from /usr/lib/libiconv.a to ... (5 Replies)
Discussion started by: kneemoe
5 Replies

5. Linux

./configure problem for libsf library due to apparently missing libdb library.

Hello, ./configure script fails to configure libsf. Please check the following last few lines of configure script error. checking for db1/db.h... no checking for db.h... yes checking for dbopen in -ldb1... no configure: error: No libdb? No libsf. But find command shows the following; ... (4 Replies)
Discussion started by: vectrum
4 Replies

6. Solaris

cpu-shares vs cpu-cap in solaris

Can anyone tell me difference between cpu-shares vs cpu-cap in solaris & how FSS will work with cpu-caps ? (9 Replies)
Discussion started by: fugitive
9 Replies

7. Shell Programming and Scripting

How to change a Makefile from building static library to shared library?

Hi: I have a library that it only offers Makefile for building static library. It built libxxx.a file. How do I in any way build a shared library? (either changin the Makefile or direct script or command to build shared library) Thanks. (1 Reply)
Discussion started by: cpthk
1 Replies

8. Solaris

Multi CPU Solaris system shows 100% CPU usage.

Hello Friends, On one of my Solaris 10 box, CPU usage shows 100% using "sar", "vmstat". However, it has 4 CPUs and prstat and glance are not showing enough processes to justify high CPU utilization. ========================================================================= $ prstat -a ... (4 Replies)
Discussion started by: mahive
4 Replies

9. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies
Login or Register to Ask a Question