Think outside the box. What application of those that you use regularly does this? Debugger, of course! But how can you achieve this behavior to emulate a low processor?
The secret to your question is asm _int 3 . This is the assembly pause me command that is sent from the attached debugger to the application you are debugging.
Read more on int 3 for this question .
You can use the code from this tool to pause / resume the process. You can add an interval and make this tool pause your application for this period of time.
The emulated cpu speed will be: (YourCPU / Interval) -0.00001% due to alarms and other processes running on your computer, but this should do the trick.
About low memory emulation: You can create a wrapper class that allocates memory for the application and replaces each allocation with a call to this class. You could set the exact amount of memory that your application can use before it can allocate more memory.
Something like: MyClass* foo = AllocWrapper(new MyClass(arguments or whatever)); Then you can have AllocWrapper allocated / deallocated for you.
Odys
source share