+ Reply to Thread
Results 1 to 8 of 8

Thread: Is there a good way to find performance hogs?

  1. #1
    Champion
    Join Date
    Jun 2011
    Posts
    561

    Default Is there a good way to find performance hogs?

    Hi guys

    Today I tried to optimize the performance of nkRebuff and I found it quite hard to find the code parts actually using the most CPU time.

    Is there a good way to find out which routine takes how much CPU time? If there's such a way I'd be very happy to learn it, cause currently I'm doing shots into the dark and things don't really improve no matter what I do.

    Cheers
    N.

  2. #2
    Soulwalker
    Join Date
    Jun 2013
    Posts
    16

    Default

    Personally, I monitor most of the addon CPU usage with something like this:

    Code:
    local cpu = Inspect.Addon.Cpu()
    for key, value in pairs(cpu[Inspect.Addon.Current()]) do
        print(string.format("%s = %08f", key, value))
    end
    But with most addons, the CPU usage usually comes from the rendering part.
    Zhevron
    Lyrai @ Faeblight NA
    Author of Tome (BETA)

  3. #3
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    Zhevron's solution is better than mine!

    If you want better granularity though, there isnt much else to do apart from start wrapping things in time related calls.

    I use something along the lines of

    Code:
    PERFTIMES_ADDONNAME = { total=0, data={} }
    
    local function perfstart(fn)
    	if PERFTIMES_ADDONNAME.data[fn] == nil then
    		PERFTIMES_ADDONNAME.data[fn] = { total = 0 }
    	end
    	PERFTIMES_ADDONNAME.data[fn].s = Inspect.Time.Real()
    end
    
    local function perfend(fn)
    	local dx = Inspect.Time.Real() - PERFTIMES_ADDONNAME.data[fn].s
    	PERFTIMES_ADDONNAME.data[fn].total = PERFTIMES_ADDONNAME.data[fn].total+dx
    	PERFTIMES_ADDONNAME.total = PERFTIMES_ADDONNAME.total + dx
    end
    
    function PERFDUMP_ADDONNAME()
    	for k,v in pairs(PERFTIMES_ADDONNAME.data) do
    		print(string.format("%40s : %.4f/%.4f", k, v.total, 100*v.total/PERFTIMES_ADDONNAME.total))
    	end
    end
    Last edited by Adelea; 06-29-2013 at 09:30 AM.
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  4. #4
    Champion
    Join Date
    Jun 2011
    Posts
    561

    Default

    Thanks for the answers. These pieces of code sure are very usefull for me.

    Finally found the problem. Got CPU time down from 10% to 0.5%.

    Thx mates

    Cheers
    N.

  5. #5
    Shield of Telara Adelea's Avatar
    Join Date
    Mar 2011
    Posts
    734

    Default

    Nice - thats a major reduction!
    http://forums.riftgame.com/image.php?type=sigpic&userid=125779&dateline=13553  38065

  6. #6
    RIFT Community Ambassador the_real_seebs's Avatar
    Join Date
    Jan 2011
    Posts
    16,859

    Default

    I believe there's profiling hooks in Lua that you could in theory use to get more data.
    You can play WoW in any MMO. You don't have to play WoW in RIFT. Oh, and no, RIFT is not a WoW clone. Not having fun any more? Learn to play, noob! I don't speak for Riftui, but I moderate stuff there. Just came back? Welcome back! Here's what's changed. (Updated for 2.5!)

  7. #7
    Rift Disciple Thorarin's Avatar
    Join Date
    Oct 2011
    Posts
    136

    Default

    I use LibPerfORate to check the performance of some key event handlers.

    KaruulAlert maintainer/co-author (Curse / Rift UI)

  8. #8
    Telaran
    Join Date
    Oct 2011
    Posts
    86

    Default bCPU

    Just thought I would add that you can get an addon from RiftUI that works great as well. It tracks all addons but you can select yours, click showgraph and click anywhere on the graph to see which routines are the highest.
    Link is http://www.riftui.com/downloads/info155-bCPU.html#info

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts