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

Really weird. The steps I take for it to work are (and you should do these on the same machine the server is running on)

  1. Start server
  2. profiler record (frames) (for reference, I tried 1000 frames)
  3. profiler status to check when the recording had stopped
  4. profiler view to get the link, which I then copied to Google Chrome
  5. Follow the guide to understand the results

Are these the same steps you’re following? If not tag me on the FiveM discord and I will try and figure out what is happening :thinking:

1 Like

I managed to get it to work today by doing the exact same thing as before.

I fixed it by creating brand new licenseKeys in keymaster.fivem.net as the initial IP on our server key was wrong.

We’d move our dedicated to a new location, and forgot all about this initial IP thingy. :slight_smile:

EDIT: Now it doesnt seem to work again. The reverseDNS hostname is refusing connection :frowning:
ERR_CONNECTION_REFUSED

I don’t think that Initial IP actually matters because in my test environment it doesn’t have the correct ip there but still works, in my live environment I have the same problems you’re having.

Also, I would NOT recommend using this in a live environment unless you want to cause your end-users lag and also too if you try to view a large profiler for example 1000 frames, it will crash the server. Just found that out the hard way lol.

So did I, haha. It’s not done async.
Keep it around 500 frames, and you’ll be good.

I also did some testing as well and I am unable to load my live bin that I saved onto my test environment, malformed JSON.

If the chrome page is blank and not loading anything how do you fix this? I have tried all of the above.

Chrome page is blank in server side, works fine in client side. Any fix for that?

when u first start ur server login to the cfx https with ur rcon password thats how u use this properly.

Here are some things you could try if you are struggling to load the file!

  • Ensure your server key is unique and not running on other servers (such as other live servers or development servers)
  • Ensure your IP registered in keymaster is correct (This shouldn’t actually matter, but do it anyway)
  • Try logging in to the CFX control panel (webadmin) when your server launches
  • Make sure you connect to the link on the SAME computer which is running the server (To avoid any firewall issues)

If all of that fails, your final attempt would be to follow the instructions in the original post to save the profile, and open the file rather than the provided link.

FYI, I have added a section about saving and opening saved files, for those struggling currently. Takes longer but should work

1 Like
Malformed timeline data: Unknown JSON format

when opening saved server capture…

  • Server key is unique, i also tried generating new one, IP is ok
  • Webadmin is started
  • I tried connecting to URL directly from server

Here is the solution for malformed JSON exception: the link given with cfx.re hostname is simply directs traffic to your server’s HTTP endpoints. Hence while connected to server using RDP or similar programs, you can change abcd-t543.cfx.re/profileData.json with localhost:port_number/profileData.json to access the profile.

2 Likes

Great resource did help me a lot, thx

After saving to .bin and trying to load I keep getting this
image
Any ideas?

Did you managed to know what was causing that? I’m having the exact same bar and wanna know if is bad :thinking:

did you find a fix? im not sure what you mean by cfx.re not replying

I write “profiler view” in the server console and I have no reply message.

how many ms is ideal?

Really depends on the complexity of the resource and what type of resource it is. C# resources have a minimum of 0.30ms I believe due to inherited overhead. While Lua resources can be as low as 0.01ms. I try to keep mine as low as possible, but still have a couple resources that fluctuate between 0.20ms - 0.50ms. Majority of my resources are below 0.05ms though.

1 Like

Mine is terrible then, look at the picture. My base is VRP with some mods. Is Scripting the time it takes the server to run all base scripts?!

Screenshot_20200110-011905_WhatsApp|243x500