Re: [Gems-users] get pid from inside ruby


Date: Tue, 09 Jan 2007 20:17:31 -0500
From: Shougata Ghosh <shougata@xxxxxxxxxxxxx>
Subject: Re: [Gems-users] get pid from inside ruby
Thanks for the reply. I had tried that before but the ASID doesn't seem to change. Maybe it changes for privileged (kernel) accesses but I filter those out anyways. I looked into the solaris source code for getpid() (opensolaris) and that function reads the current_thread address from %g7. I converted the content of %g7 to physical address and read the memory content at that location. That doesn't seem to change either. I'll dig some more.

I have the following 2 questions, however.

1. I see simics has a mmu module (cheetah, spitfire) that I can load. The mmu has a primary_context register. If I load the mmu module, how can I access it's functions and members from ruby?

2. Sometimes when I load ruby, I get this error from simics:
 * ERROR: object 'ruby0' has no queue associated
 patching by forcing association to processor object 'cpu0'

I used the following configuration to load ruby:
#Disable STCs here
dstc-disable

#Disable breakpoint before sync-ing processors
magic-break-disable

#Use 1 cycle cpu-switch-time
cpu-switch-time (4)
c 10000

#Print new cpu switch time
cpu-switch-time

#Enable breakpoint
magic-break-enable

#Load module ruby
load-module ruby

#Ruby parameters
ruby0.setparam g_NUM_PROCESSORS 16
ruby0.setparam g_PROCS_PER_CHIP 1
ruby0.setparam g_MEMORY_SIZE_BYTES 268435456

ruby0.init

Once I initialise ruby, I get the following output from simics:

successful installation of the ruby timing model.
Ruby Timing Mode
Warning: optimizations not enabled.
Creating event queue...
Creating event queue done
Creating system...
 Processors: 16
Creating system done
Ruby initialization complete

But later on, I get that error message!
Any clue why that might happen?
Thanks a lot.

------------------------------------------------
There might be an ASID (address space ID) in the memory_transaction_t struct
passed by Simics.  But I'm not sure.

--Mike


 -----Original Message----- From: gems-users-bounces@xxxxxxxxxxx
 [mailto:gems-users- bounces@xxxxxxxxxxx] On Behalf Of Shougata Ghosh
 Sent: Sunday, January 07, 2007 3:06 PM To: gems-users@xxxxxxxxxxx
 Subject: [Gems-users] get pid from inside ruby

 Hi Has anyone tried to get the pid of a process from inside the
 simulator for Solaris 10 running on UltraSPARCIII+? I am trying to
 figure out from inside ruby (I don't load opal) which process is
 making the memory requests. Before digging into solaris 10 data
 structures and many hours of experimentation, I was wondering if
 anyone had already done it. Any reply/hint/ideas would be greatly
 appreciated. Thanks!
[← Prev in Thread] Current Thread [Next in Thread→]