Hi there, this is my first post, after my first program in OFX.
I friend of mine made a program which I’m continuing and I got to the first BUG, can someone please help me?
The program is an interface to receive serial information from an arduino and send from it MIDI triggers. It is a rather simple program that has its own protocol with only 12 bytes that graphs it and has an onset tracker that triggers a note when the sensor values goes above a threshold.
I only use, MIDI, GUI, XML Addons…
I compiled it using OpenFrameWorks 0.8.4 and XCode 6.2 running on a OS X 10.9.5, where I chose as Base SDK OS X 10.9 (Mavericks).
It was all ok running on my old mac book pro It didn’t get up to 60 fps, as intended. But ran rather well at 30 fps. The problem started when I installed it in a much faster Macbook pro retina, with a lot more RAM and faster processor. Everytime I run it there, it it stays around 1 or 2 fps… This other macbook is running also with Mavericks, 10.9.3 though…
Does anyone have a clue of what might be going on?
I can’t update this other macbook to the same os x version as mine, Now I can only upgrade it to El Capitan, and since it is used with some old peripherals that didn’t update the drivers, its to risky to get up to 10.11…
Hope someone can help me…
first, do you see anything obvious in the console ?
second, can you try commenting out the draw or the update and see if one or the other is slow, I usually comment out blocks of code to see what’s going on.
third, you can use a profiler from xcode to see what is taking the most time.
common culprits for slow code:
a) loading assets in update or draw instead of setup
b) memory leak
c) some OS specific code that might be blocking
d) uninitialized variable that gets a bad value based on memory
you can also post your code or the smallest possible slow example and folks here can take a look.
Thank you for the help Zach,
The computer I’m running the program is from a client that doesn’t have XCode installed, I just ran the binary… I will see install it there and check it out.
What I’m finding weird is that the seven cores run at almost 100% in his computer and in mine it doesn’t use more than 50% of one of the 4 cores…
I’ll check out these things you said and I’ll write back
I’d carefully look at variables - a common mistake in c++ is to have a variable and not set it to an initial value. The first time you use it, it could be anything, and it differs from machine to machine.
I’d also monitor memory usage, is the app leaking memory? that can impact performance greatly…
I’m guessing it looks and works exactly the same but is running slower?
If not you might have missed an asset or two and it’s printing out tons of stuff to the console to complain about this. Shouldn’t slow it down that much but it could be related.
Either way open the Console.app on that system, your ofLogNotice() or cout, etc will be there and might help you track it down.
Without some of the tips Zach said, it’s pretty hard to know what’s going on.
Regardless of that, the first thing I thought was the serial data. Drivers, connections, bus sharing, etc. can cause serious bottlenecks. So, this would be the first I would start to debug.
If serial is the culprit, maybe you can try ofxSerial, since it uses it’s own thread.
After cracking my head against the code in many ways I found out this was a simple conflict with an outdated driver of a sound board…
Apparently the code worked slowly only when this board was on.
Does anyone know of a procedure I can do to find out quickly this kind of bug in OS X?