Closed weimzh closed 5 years ago
nice find. I saw that video and noticed that stuttering - not good.
Maybe you can explain to me some time how you run XCode Instruments with RealBot? It would be helpful for me to debug and see myself. (Now I use CLion from Jetbrains and run make
from cmd line).
One thing though about this issue. rblog
always opened file and such. One thing I change recently is added a printf
in that function. Perhaps that causes the stuttering? Or did you also have the stuttering on the 'older' versions of RealBot? (ie build 30xx?)
the above screenshot already shown that the problem is caused by fopen()/fclose() (under cBot::setGoalNode() call). printf() does not take much time there.
EDIT: check out one of the answers in this question for detailed usage of instruments tool: https://stackoverflow.com/questions/11445619/profiling-c-on-mac-os-x/11445777
Sure thing. I already started working on this in between work ;-)
i had some left-over changes. Pushed it regarding this. Basically it opens the file once (on startup). Unfortunately I could not find a quick way to close the file at the right moment.
@CecilHarvey let me know if you need a binary or you could compile it yourself. I suppose the latter since you managed to get it working on your mac ;-)
Do note, latest commits (after d566476) have by default logging enabled (debug messages), which spam your log file. So do not use that.
sorry for late reply
I tested commit d566476 under Fedora GNU/Linux (as latest version of xcode no longer supports compiling for 32-bit - which unfornately means Half-Life for macOS will be dead soon if not updated to 64-bit), and fps is good.
no probs.
Too bad about macOS, I am still on Sierra, so I'm still good I guess.
Good to hear it was fixed with this patch.
Although I think why i close/reopen the file. I noticed if I don't do this that upon a crash sometimes not all data is flushed to a file.
Yes well that Mac OS X Catalina is bloody ridiculous along with Apples overpriced computers and phones. So you maybe best off ignoring macOS for the future...
@CecilHarvey instead of open/close, i use fflush
now. All is well, you can use the latest commit now if you want.
as title.
video: https://youtu.be/5g2ZyasCHQc
I profiled a bit with Instruments tool included with xcode, and found that rblog() (which writes a lot of log messages to reallog.txt) caused problem:
possible solution: only open the reallog.txt file once, and close it when program exits.