HI,
I have tried casting the Tick arguments as int, Tick and long from the Python.
None of these work, and return "NotImplementedError" as before.
The only success has been by creating a wrapper for the function in the C++
which accepts "int" or "long long" for the "Tick" arguments, then casts these
to Tick within the C++. Obviously, this is only useful as a temporary
workaround and is very inelegant.
As you said, the argument for internal.core.setClockFrequency(int(tps)) is
Tick, and casting it as an integer from python works. However, this does not
work for schedStatEvent. I have looked at the python and swig files for each
and can't tell what the (probably subtle) difference is.
Do you have any further ideas?
Thanks,
Sascha
From: [email protected] [mailto:[email protected]] On
Behalf Of Steve Reinhardt
Sent: 23 April 2012 15:12
To: gem5 users mailing list
Subject: Re: [gem5-users] Calling schedStatEvent from python
I just looked through the code briefly, and one possible issue here is that the
Python 'Tick' class isn't related to the C++ Tick class. The Python Tick is
defined in src/python/m5/params.py for use as a SimObject parameter, while what
SWIG is probably expecting is a wrapped version of the C++ type, which is "long
long".
I notice that setClockFrequency() in core.i also takes a Tick arg, and that's
called from python/m5/ticks.py like this:
internal.core.setClockFrequency(int(tps))
In the long run, it would be good to make the Python Tick class work for SWIG
calls that want a C++ Tick; I'm not sure how to fix this though. Any ideas,
Nate?
Steve
On Mon, Apr 23, 2012 at 12:54 AM, Sascha Bischoff
<[email protected]<mailto:[email protected]>> wrote:
Hi all,
I am trying to use the schedStatEvent C++ function from python. When I try and
call the function from python using the interface in src/python/swig/stats.i
I am unable to specify the Tick parameter, and gem5 complains that I have
supplied the incorrect number of arguments.
I am able to specify the boolean parameters without issue, and am able to run
the
function once at the start of the simulation by only specifying the bool
arguments.
However, I wish to be able to schedule a repeating event from within python, and
must therefore be able to specify when the first event should occur and how
often
it should repeat (Given by the two Tick parameters).
I have tried specifying the Tick parameters using Param.Tick() and simply Tick()
but have been rather unsuccessful. I have also tried simply supplying integers.
The error I get is below:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/sascha/Repos/gem5/src/python/m5/main.py", line 357, in main
exec filecode in scope
File "configs/example/fs.py", line 66, in <module>
schedEvent(True,True,Tick(0),Tick(100))
NotImplementedError: Wrong number of arguments for overloaded function
'schedStatEvent'.
Possible C/C++ prototypes are:
Stats::schedStatEvent(bool,bool,Tick,Tick)
Stats::schedStatEvent(bool,bool,Tick)
Stats::schedStatEvent(bool,bool)
Does anyone have any ideas as to how I can solve this?
Thanks,
Sascha
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you.
_______________________________________________
gem5-users mailing list
[email protected]<mailto:[email protected]>
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
-- IMPORTANT NOTICE: The contents of this email and any attachments are
confidential and may also be privileged. If you are not the intended recipient,
please notify the sender immediately and do not disclose the contents to any
other person, use it for any purpose, or store or copy the information in any
medium. Thank you._______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users