Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Oct 2000 13:48:25 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        "Christopher Harrer" <charrer@alacritech.com>
Cc:        "Freebsd-Hackers" <freebsd-hackers@FreeBSD.ORG>
Subject:   Re: Determining CPU on SMP box 
Message-ID:  <200010242048.e9OKmPh02075@mass.osd.bsdi.com>
In-Reply-To: Your message of "Tue, 24 Oct 2000 07:37:12 EDT." <POELKPJGDHAPIPMEMHGACELJCIAA.charrer@alacritech.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Is there a way to determine which CPU I'm currently executing on in a SMP
> box?  I've found references to proc->p_oncpu, but I'm not sure if this is
> the best way to determine where I'm executing.  I'd like to be able to
> "trace" various actions within my driver and one of the fields I want to
> keep track of is what CPU I'm executing on.

There's a per-CPU variable 'cpuid' (at least, there used to be) that you 
could use for this.  However, it's kinda pointless working out what CPU 
you're on, since you're liable to be rescheduled onto another CPU if an 
interrupt occurs...

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010242048.e9OKmPh02075>