On Tue, Feb 11, 2014 at 12:03:04AM +0000, Chris Davies wrote:
> Marco Ippolito <maroloc...@gmail.com> wrote:
> > How can I `echo', in `bash', the core # the current script is running on?
> 
> This will probably do it for you
>     awk '{print $39}' /proc/$$/stat
> 
> See proc(5) for details, including the 39. Please also note that unless
> you've set the task affinity (see taskset(1) for details) the process
> can - and will - be reassigned different cores during its lifetime.
> 
> Chris
> 

Very cool!

jeri@hudson:~$ awk '{print $39}' /proc/$$/stat
2
jeri@hudson:~$ awk '{print $39}' /proc/$$/stat
3
jeri@hudson:~$ awk '{print $39}' /proc/$$/stat
0
jeri@hudson:~$ awk '{print $39}' /proc/$$/stat
1
jeri@hudson:~$ awk '{print $39}' /proc/$$/stat
2
jeri@hudson:~$

-- 
Jeremiah Mahler
jmmah...@gmail.com
http://github.com/jmahler


-- 
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org 
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org
Archive: http://lists.debian.org/20140211025650.GA24118@hudson.localdomain

Reply via email to