LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 04-17-2010, 01:51 AM   #1
casper1973
LQ Newbie
 
Registered: Apr 2010
Posts: 2

Rep: Reputation: 0
Post How can i retrieve the VCTX, ICTX values of a process on Linux ?


I am implementin a utility to provide the process statistics by reading the /proc/<pid>/stat.
However , I am not able to figure out how to calculate the number of Voluntary context switches and involulentary context switches.
I am using RHEL 5.8
 
Old 04-26-2010, 07:33 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Try /proc/<pid>/status instead:

Code:
cat /proc/<pid>/status | grep _ctxt_
 
Old 04-27-2010, 09:58 AM   #3
casper1973
LQ Newbie
 
Registered: Apr 2010
Posts: 2

Original Poster
Rep: Reputation: 0
The kernel version that we have is 2.6.18-164.el5. On this we do not have VCTX,ICTX and SYSC available in /proc/<pid>/status
Pasted below is an extract for you.
Name: java
State: S (sleeping)
SleepAVG: 0%
Tgid: 2067
Pid: 2067
PPid: 1
TracerPid: 0
Uid: 11310 11310 11310 11310
Gid: 2003 2003 2003 2003
FDSize: 512
Groups: 2003 2004
VmPeak: 2136508 kB
VmSize: 465064 kB
VmLck: 0 kB
VmHWM: 161160 kB
VmRSS: 161156 kB
VmData: 412060 kB
VmStk: 132 kB
VmExe: 36 kB
VmLib: 23452 kB
VmPTE: 692 kB
StaBrk: 48f5f000 kB
Brk: 48fee000 kB
StaStk: 7fff0d6097e0 kB
Threads: 163
SigQ: 0/529408
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 0000000000000003
SigCgt: 1000000189005ccc
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
Cpus_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,0000ffff,ffffffff
Mems_allowed: 00000000,0000000f
 
Old 04-27-2010, 10:32 AM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
It doesn't look like that information was available under /proc until 2.6.23, you may be out of luck...
 
  


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
fork(), variable values between child and parent process???? dearvivekkumar Programming 6 02-24-2010 05:18 AM
retrieve linux kernel messages? smeezekitty Linux - Newbie 9 12-21-2009 12:51 AM
how do i get the values for the user time and system time for a process. aloktiagi Linux - Newbie 3 08-04-2009 06:55 PM
process priority,nice -- small question regarding high/low priority values beeblequix Linux - Newbie 1 10-11-2006 10:22 AM
reading values for a background process shadowman21i Programming 1 12-22-2004 06:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:58 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