[How-to] Use the profiler command to identify problematic scripts

it does not need to be a local host… i did this with ssh into my linux server in another country…

you can run it, and send out a system message that player might be a a bit slow in order to find a problem on the server.

then why does the view function in chrome open it in a form that can be saved just fine? and why even have the save if it fails at that point? sure i can open it on another computer and use profiler view, but that means i have to open up fivem on the system i want to view it on(something i cannot do most of the time due to a rather horrible system when i’m in school, where i do most of the debugging) so saving it as a file, opening that file in chrome is much more useful than having to install fivem on my programming laptop(with nowhere near the specs required to run fivem, nor the space) hence why i was confused at it not working when saved…

really should consider making it save as a regular json file so people like me and most of my friends currently can just use the profiler and save it, then send it to me, and i can start working on it.

the way it works now would mean i have to remote into my computer at home to get any work done.

Similar to @bozoweed, my profiler command for my server doesn’t do anything. Anyone know why it doesn’t want to work on the server?

Typing “profiler start 500” does not give any message or do anything. Neither does “profiler view”.

Typing “cmdlist” does show “profiler”, but it doesn’t seem to work for some reason.

because that’s pre-converted?

so it can be acted upon in-game/on the server? also it doesn’t ‘fail’?

sounds like a you issue

also note the server also has a load/view command.

are you even invoking it from the actual server console or are you using some odd rcon tool? if the latter, it does ‘do anything’ but you just didn’t bother to even check profiler status and assumed ‘hurr it does nothing!~!!!’

true it’s a me issue that i cannot run the game from my laptop, but it just seems stupid to me that its “encrypted” in a sense when you save it… on the server i COULD use the view command, but i doubt it would work on an SSH tunnel into a machine without a desktop environment installed, or even a browser for that matter… hence why i was saving them and downloading them to my laptop for viewing, which i now know i cannot do because of the weird way it gets saved so only fivem can open it again(unless you open it and save it within the browser)

What do you really want to look out for?. Like if I have a script that is nice. Can I somehow know what lines that are not good and bad?. I really want to learn this and fix our problem because now our server is going up to 190k hitch even more sometimes. Glad if someone can explain.

because of the loop never stop until the server cant handle and goes down

I’m trying to view a server-sided profile, server-side is on linux, so, I record it, I save it as profile.bin, I download it to my home pc, so I start my home-hosted server, I try to run “profiler load profile.bin” and it’s telling me “profiler load is not a command”…So I tried doing “profiler view profile.bin”…it shows me a link, I try opening it on Chrome, and it’s not showing anything…(screenshot below)

So…how could I load/view a downloaded .bin from my linux hosting? Since my VPS doesn’t have a Desktop GUI installed and I can’t directly view it from VPS since no Chrome installed.

1 Like

Is the load command new? Cause on the 2381 artifacts it doesn’t work

load looks best as a client side command, so you can put the file from the server in the following location and then load it into the client to then run profiler load <filename>.

Location: %localappdata%\FiveM\FiveM.app\citizen

Edit: On reading the code, it looks like load is not implemented and the code is server and client side, but you can pass a file name to view

Do correct me if I’m wrong: https://github.com/citizenfx/fivem/blob/master/code/components/citizen-scripting-core/src/Profiler.cpp

Edit2: Updated given Zeemahs’ information to make the folder location easier to use.

Working server side prfiler - when the server is not localhost is done by removing the S from https:// and the server link has to be http://xxx.xxx.xxx.xxx:30120/profileData.json
where xxx.xxx.xxx.xxx is ip or domain and 30120 is the port (default)

http://frontend.chrome-dev.tools/serve_rev/@xxx/inspector.html?loadTimelineFromURL=http://xxx.xxx.xxx.xxx:30120/profileData.json

You don’t need webadmin started.

%localappdata% exists, btw.

This is why I’m paid to do development and not IT work. Thank you, this is going into my knowledge bank.

download link ?

For everyone getting the “Malformed timeline data: Unknown JSON format” when trying to access the link server side. Here was my solution:

When I went to the keymaster website, I noticed that my server was registered twice. Even though obviously only 1 key was being used, it still had 2 separate keys assigned to my IP. I disabled the one that wasnt in my server.cfg, and restarted my server. After that, running a profiler view from server and copy/pasting the link on my home computer in Chrome worked.

For reference i connect to a VPS linux terminal hosted by ZAP. So I was not connected to my linux computer in any way other than through SSH.

When I went to the keymaster website, I noticed that my server was registered twice. Even though obviously only 1 key was being used, it still had 2 separate keys assigned to my IP. I disabled the one that wasnt in my server.cfg, and restarted my server. After that, running a profiler view from server and copy/pasting the link on my home computer in Chrome worked.

What if i have also dev server to test onesync problems? Is there any other solution?

this is pretty much useless when you fighting against memory leaks.

Hello can anyone help me with fixing hitch warnings the server seems fine for few hours with no hitches then they start to happen but as the server is running over time for 4 hours or more they get worse and worse as each hour goes by. It is complaining about trew_hud_ui lines 9 - 31 here is the screen shot and the code i dont see a problem any ideas?

Imgur

Imgur

same issue over here. is there a solution to this? my server is running on linux and there is no tutorial on this whats hoewever.

1 Like