Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Lua Code / Native Profiler
- Can be used in runcode
- Make functions with a name and run it
- Automatically runs the profiler and views the results
- Records 3 frames
- ]]
- local iterations = 10000
- local tests = {
- ["GetPlayerPed(-1)"] = function()
- GetPlayerPed(-1)
- end,
- ["PlayerPedId()"] = function()
- PlayerPedId()
- end,
- ["PlayerId() to GetPlayerPed"] = function()
- GetPlayerPed(PlayerId())
- end,
- }
- -- command hax
- RegisterCommand("profiler", function() end)
- RegisterCommand("record", function() end)
- RegisterCommand("view", function() end)
- CreateThread(function()
- ExecuteCommand("profiler record 4")
- Wait(0)
- while ProfilerIsRecording() do
- for test, func in next, tests do
- ProfilerEnterScope(test)
- for i = 0, iterations do
- func()
- end
- ProfilerExitScope()
- end
- Wait(0)
- end
- ExecuteCommand("profiler view")
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement