Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ProfilerInit(1000) -- Init profiler with a maximum of 1000 function profiles
- -- Create a function profile with a sample buffer of 1000 samples
- -- We will use this profile to tell the profiler what name we want the data stored under
- -- This will also be the name of the profile file in the "profiles" directory
- -- This profile will take up one of our 1000 maximum profiles
- local profile_test = CreateProfile("TestFunction")
- -- Some code to profile, just adds 1 1000 times
- function test_function()
- local i = 0
- while i < 1000 do
- i = i + 1
- end
- end
- -- Lets get 100 samples for this profile, usually the profiler would be used in the game loop
- -- The profiler will automatically start overwriting the oldest samples, so dont worry about using it in the game loop
- local j = 0
- while j < 100 do
- print("Testing")
- StartProfile(profile_test) -- Tell the profiler to start profiling, and store the data under "TestFunction"
- test_function() -- Call our super useful function we made, this can also just be a block of code or something
- StopProfile(profile_test) -- Tell the profiler we're done recording the data
- j = j + 1
- end
- -- The profiler will write the profiles to the disk when the server shuts down
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement