LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-21-2007, 11:20 PM   #1
sun_sun
LQ Newbie
 
Registered: Nov 2007
Posts: 21

Rep: Reputation: 15
Meaning of entries in /proc/pid/cpu


hi,

can anyone tell me the meaning of entries in /proc/pid/cpu.

i see something like:
cpu 176787 14
cpu0 16732 7
cpu1 3542 3

Please tel me how to read this lines.

need this ASAP..

thanks in advance..
sun
 
Old 11-21-2007, 11:38 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
man proc is about as ASAP as you can get.
ta0kira

EDIT: That path doesn't exist on my system or in the proc manual.

Last edited by ta0kira; 11-21-2007 at 11:45 PM.
 
Old 11-22-2007, 12:47 AM   #3
sun_sun
LQ Newbie
 
Registered: Nov 2007
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ta0kira View Post
man proc is about as ASAP as you can get.
ta0kira

EDIT: That path doesn't exist on my system or in the proc manual.
Yeah..
but man proc doesn't quite clearly explain the meaning of these entries,
i want to know what is cpu0/1/2 and the nos in front of them...

PS : u'll not find this path in ur sytem..as pid has to be some no of the process running ...u can see this like ..when u run something like ..pid = 897 ..then there'll be an entry in /proc/897/..
 
Old 11-22-2007, 01:15 AM   #4
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Originally Posted by sun_sun
PS : u'll not find this path in ur sytem..as pid has to be some no of the process running ...u can see this like ..when u run something like ..pid = 897 ..then there'll be an entry in /proc/897/..
There are always some processes running (check 'top' or 'ps'), so it can't be that.

I guess cpu0 and cpu1 could refer to two processing units, do you have a dualcore cpu or something? I could be wrong, though.. The whole /proc filesystem is a peek hole into the kernel, so if it's not present on somebody's system, it could be that functionality is disabled in that kernel then, and enabled in yours. Guesses, but still.
 
Old 11-22-2007, 06:20 AM   #5
sun_sun
LQ Newbie
 
Registered: Nov 2007
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by b0uncer View Post
There are always some processes running (check 'top' or 'ps'), so it can't be that.

I guess cpu0 and cpu1 could refer to two processing units, do you have a dualcore cpu or something? I could be wrong, though.. The whole /proc filesystem is a peek hole into the kernel, so if it's not present on somebody's system, it could be that functionality is disabled in that kernel then, and enabled in yours. Guesses, but still.

what do the nos mean ??
want to know that too..
 
Old 11-22-2007, 09:00 AM   #6
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Quote:
Originally Posted by sun_sun View Post
PS : u'll not find this path in ur sytem..as pid has to be some no of the process running ...u can see this like ..when u run something like ..pid = 897 ..then there'll be an entry in /proc/897/..
Yes, I took that into account. I don't have a cpu entry in any process folder, and in fact don't have any entry named cpu anywhere in /proc.
ta0kira
 
Old 11-22-2007, 11:19 AM   #7
sun_sun
LQ Newbie
 
Registered: Nov 2007
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by ta0kira View Post
Yes, I took that into account. I don't have a cpu entry in any process folder, and in fact don't have any entry named cpu anywhere in /proc.
ta0kira

boss..when a process with pid=897 runs, then during the run, you'll see /proc/897/cpu..if you do "cat /proc/897/cpu" -- then you'll see the nos as i mentioned above...only during the process is running..
 
Old 11-22-2007, 02:12 PM   #8
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Yes, I'm aware of the fact that all processes have their directories in /proc, but even if I do ls /proc/self/cpu, ls /proc/*/cpu, or find /proc -name cpu I get nothing. There are literally no entries in my entire /proc tree which are labeled "cpu".
ta0kira
 
Old 11-22-2007, 04:15 PM   #9
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Which distro are you running?
 
Old 11-22-2007, 05:09 PM   #10
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Slackware 12.0, kernel 2.6.21.5.
ta0kira
 
Old 11-22-2007, 10:23 PM   #11
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Okay, let’s clear some things up…
  1. It’s quite rude of anyone with any problem to go to a free forum and demand an answer ASAP.
  2. There are very few situations where the need to know the information provided by /proc entries could be considered urgent at all.
  3. If the OP did think this was such an urgent problem, the OP could have given more information (e.g., kernel version).
  4. /proc/$PID/cpu is an entry on 2.4 kernels with CONFIG_SMP enabled
  5. Upon reading from /proc/$PID/cpu on such kernels, the output is as follows:
    Code:
    cpu total_user_time total_system_time
    cpu0 user_time_on_cpu0 system_time_on_cpu0
    cpu1 user_time_on_cpu1 system_time_on_cpu1
    cpu2 user_time_on_cpu2 system_time_on_cpu2
    ⋮
    for as many “cpus” recognized by the kernel.

Last edited by osor; 11-22-2007 at 10:28 PM.
 
Old 11-22-2007, 11:02 PM   #12
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Quote:
Originally Posted by ta0kira View Post
Slackware 12.0, kernel 2.6.21.5.
ta0kira
I was asking sun_sun. I can see yours. Probably sun_sun's distro has made some more options to proc filesystem. I don't have cpu entry either.

EDIT: Now I've read Osor's post.

Last edited by Alien_Hominid; 11-22-2007 at 11:04 PM.
 
Old 11-24-2007, 11:11 PM   #13
sun_sun
LQ Newbie
 
Registered: Nov 2007
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Alien_Hominid View Post
I was asking sun_sun. I can see yours. Probably sun_sun's distro has made some more options to proc filesystem. I don't have cpu entry either.

EDIT: Now I've read Osor's post.
ok ok ...
you can skip the word ASAP...but then i needed it at the earliest..i thought to post it..by the time..i was trying to figure that out on my own..
nyways..
thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Meaning of entries in /proc/pid/cpu sun_sun Linux - General 1 11-22-2007 03:09 PM
/proc/pid/io seems not to work kornelix Linux - Server 5 06-17-2007 02:39 AM
/proc/<pid>/stat shows zero cpu usage simchac Linux - Kernel 0 07-25-2006 07:26 AM
Reading /proc/<pid>/mem magnus.therning Programming 2 07-16-2006 08:29 AM
Process Resurrection and /proc/pid lackluster Programming 3 03-20-2006 05:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration