THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 24/11/2010 at 18:00, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 12
Platform: Windows ;
Language(s) : C++ ;
---------
Hey all,
A user reported a rather disturbing problem. With my plugin loaded one of the processor cores is constantly showing usage in excess of 50% with consistent spiking up to 100%. I've traced the cause back to a timer in a MessageData class that ticks by at a rate equal to the document fps.
The real problem is this: The problem is strictly on windows. Not "it's worse on windows", I mean ONLY ON WINDOWS. On mac, the processor cores aren't even phased by this timer (or any of the code that's called as a result of the message ticking by). With my plugin loaded the processor is 98% idle. Without my plugin loaded the processor is 98% idle. Not even a nick in processor usage on any particular core.
I'm pretty sure the user is running Win7 64bit (what flavor I don't know). I'm running Win7 64bit Home Premium. Mine is bootcamped on a Mac Pro... I doubt the user's is the same setup; probably your standard mix n' match pc build. I won't name him, but judging by his forum posts over the years I doubt he's running a pre-built POS Dell or anything like that.
So, how do I even approach fixing a problem like this?
Here's my entire MessageData class (in main.cpp) :
class Con4DMessage : public MessageData
{
virtual LONG GetTimer(void)
{
BaseDocument *doc = GetActiveDocument();
if (!doc) return 50;
LONG currentframe = doc->GetFps();
LONG framerate = 1000/currentframe;
return framerate;
}
virtual Bool CoreMessage(LONG id, const BaseContainer &bc)
{
if (id == MSG_TIMER)
{
BaseDocument *doc = GetActiveDocument();
BaseSceneHook *sh = doc->FindSceneHook(ID_CON4D_HOOK);
if (!sh) return FALSE;
sh->Message(ID_CON4DHOOK_MESSAGE);
}
return TRUE;
}
};
Bool RegisterCon4DMessage(void)
{
return RegisterMessagePlugin(ID_CON4DHOOK_MESSAGE_DATA, String(), 0, gNew Con4DMessage);
}
The message gets passed to a scenehook btw.
thanks,
kvb