logo logo

 Back to main page

The NWNX Community Forum

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
[profiler] What to do with the information?

 
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules
View previous topic :: View next topic  
Author Message
Jack_Wellignton



Joined: 11 Jan 2005
Posts: 2

PostPosted: Tue Jan 11, 2005 8:58    Post subject: [profiler] What to do with the information? Reply with quote

Hello guy I just dl your program and was mainly interrested about the profiler. Recently, I became technician (mostly mapping for me) on a french module called ''Royaumes Insulaires'' (two module). Our module is well know around french community and somewhat respected. However, because of frequent change in staff and passing of module between many hand (some not so experimented), I find it has accumulated lot of problem over time. I thought your program was a nice way for me to try and maybe catch one or two big old crappy script. After installation, I ran it first time and got some interresting data... but... what do I do now!? For starter like me how can we know a script is heavy? With my data could you give some hint as to how I should then use it to kill some lag? I know that some script are naturally more important and heavy then other but was is acceptable? When does supposed ''light''(not important) script become heavy? Finally how many msec are there in 1 hour 35 min (joking)?

Quote:
Current statistics
-----------------------------------------------------------------------------------------------
nw_o2_zombie 0 msec 1 calls *| >onspawn_dissimu 0 msec 2 calls *|
>divers_spawnsit 1 msec 15 calls *| divers_spawnsit 0 msec 15 calls *|
nw_o2_dttrapdoor 0 msec 1 calls *| bbs_scribe_spawn 15 msec 1 calls *|
mod_load_params 0 msec 1 calls *| it_onenter_15pg 0 msec 2 calls *|
it_effettoile 80 msec 41 calls *| save_loc_enter 0 msec 17 calls *|
it_onenter_9pg 0 msec 5 calls *| vn_tav_serveuse1 0 msec 2 calls *|
it_despawner 0 msec 1 calls *| >it_effettoile 0 msec 41 calls *|
it_onenter_14pg 0 msec 1 calls *| it_onenter_22pg 0 msec 2 calls *|
x2_def_spawn 73 msec 15 calls *| applik_efft_beam 1 msec 1 calls *|
encounter_jour 0 msec 2 calls *| it_onenter_3pg 0 msec 1 calls *|
>onspawn_mort 1 msec 30 calls *| vn_habonspawn 97 msec 18 calls *|
onspawn_assis 1 msec 3 calls *| at_chapardage 0 msec 21 calls *|
mod_item_acq 55 msec 1087 calls *| nw_c2_dropin9 6 msec 6 calls *|
mod_local_enter 0 msec 18 calls *| nw_o2_skeleton 0 msec 1 calls *|
nw_c2_default7 0 msec 4 calls *| effet_nuage_jaun 1 msec 1 calls *|
onspawn_mort 8 msec 15 calls *| mod_control_dial 0 msec 1 calls *|
onhb_portclos 0 msec 9 calls *| onspawn_fantome 0 msec 1 calls *|
pw_on_enter 0 msec 1 calls *| slave_spawn 0 msec 2 calls *|
>effet_nuage_jau 0 msec 1 calls *| tresorfaible2 0 msec 1 calls *|
onspawn_dissimul 1 msec 1 calls *| >spawndaemon 847 msec 31 calls *|
spawndaemon 17 msec 24 calls *| >nw_c2_default9 20 msec 102 calls *|
nw_c2_omnivore 0 msec 2 calls *| nw_c2_herbivore 2 msec 5 calls *|
nw_c2_default9 230 msec 232 calls *| mod_heartbeat 0 msec 1 calls *|
s_05_sourcvie_en 0 msec 1 calls *| pw_on_exit 0 msec 1 calls *|
-----------------------------------------------------------------------------------------------
Elapsed time : 10012 msec
Runtime delta : 1456 msec
Total cumulative runtime : 1456 msec
Total number of scriptcalls : 1787


Please dont laught Rolling Eyes ... Thank for the sharing and congratulation for work on Avlis (it's a reference for me).
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Jan 11, 2005 11:18    Post subject: Reply with quote

It's all relative. There is no way to tell if a script eats up too much CPU time in a absolute way.

I would start with those scripts that have the highest msecs (e.g. spawndaemon) or the highest total calls (e.g. mod_item_acq) and try to make them more efficient or call them less often.

Btw, a runtime delta of 1456 msec is pretty high. Depending on player load, Avlis rarely gets over 600 msecs.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Jack_Wellignton



Joined: 11 Jan 2005
Posts: 2

PostPosted: Tue Jan 11, 2005 16:20    Post subject: Reply with quote

Very old script... the first one I checked actually after looking at data. It actually used to spawn pnj at difinite time and run on a on_hearthbeat. It is an important script in some way and used a lot. I will try and convince my team to convert spawn from this system to encounter. Thank for the hint..
Back to top
View user's profile Send private message
Jurivancer



Joined: 08 Jul 2005
Posts: 2

PostPosted: Fri Jul 08, 2005 3:01    Post subject: Runtime Delta Reply with quote

After the 1.66 update, we have been experiencing severe lag problems in our mod.

We have been trying to clean up stuff and remove any old, now extraneous scripts, etc.

We came upon your profiler and decided to go over the log files and see if we can find some useful info from it.

I am currently going over a log file, and one of our sections has what I assume to be a very high runtime delta:

Current statistics
-----------------------------------------------------------------------------------------------
onmoduleload 0 msec 1 calls *| no_scr_logspnloc 0 msec 1 calls *|
exposemap 1 msec 210 calls *| frc_rulebook 0 msec 1 calls *|
no_spn_melcast3 14 msec 1 calls *| x2_def_spawn 1030 msec 168 calls *|
nw_c2_dropin9 35 msec 2 calls *| frc_remove_temp 72 msec 2342 calls *|
sitonspawn 0 msec 1 calls *| no_scr_logeq 0 msec 1 calls *|
_mod_onenter 7 msec 1 calls *| acquireditem_tag 2751 msec 2342 calls *|
>no_spn_melcast3 0 msec 1 calls *| x0_ch_hen_spawn 4 msec 8 calls *|
torch_onequip 0 msec 5 calls *| nw_c2_omnivore 23 msec 7 calls *|
nw_c2_herbivore 168 msec 64 calls *| nw_c2_default9 1737 msec 263 calls *|
-----------------------------------------------------------------------------------------------
Elapsed time : 10005 msec
Runtime delta : 5842 msec
Total cumulative runtime : 5842 msec
Total number of scriptcalls : 5420

Now, I can look at this and see which scripts are called the most and which have the highest runtime, but what does the "Runtime Delta" actually mean?

(most other log blocks are in the 3-400 range with a couple being around 1000-1500, this being the most extreme example of a high runtime delta I thought I would post it).

Any info would be appreciated.
_________________
DM Jurivancer
Forgotten Realms Cormyr
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Fri Jul 08, 2005 8:18    Post subject: Re: Runtime Delta Reply with quote

Ouch. I can see where the lag would show up.

I can't pretend to understand what the "Delta" is but we normally run at around 800. Previous experience shows that when we go over 2,000 we start to have lag.

Look for scripts that have a hight MSec time compared to # of calls.

Example:
exposemap has 210 calls but only uses 1 msec
x2_def_spawn has 168 calls but takes 1030 msec to run them

Look over the rest of the scripts in the module and see if you can find other high msec to # run ratios. Remember that the script engine is single-threaded, if it takes one second to run a script the whole module stops while that script runs.....
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Fri Jul 08, 2005 10:34    Post subject: Reply with quote

Runtime delta is the amount of time the profiler has recorded between two statistics update. In other words, the difference between the current "Total cumulative runtime" and the last "Total cumulative runtime". It's the total amount of time your scripts used up in the last ~10 seconds.

The example you posted seems to be the very first iteration (i.e. module load), which is not representative.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Jurivancer



Joined: 08 Jul 2005
Posts: 2

PostPosted: Fri Jul 08, 2005 16:28    Post subject: Reply with quote

Thanks for the info.

Yeah, I'm guessing you are right about the log I posted being the startup.

Here is a followup to the Runtime Delta question.

I picked a log entry from the middle of the accumlated log, look at at all the scripts and such, then I go to the summary:
Quote:


-----------------------------------------------------------
Elapsed time : 10296 msec
Runtime delta : 510 msec
Total cumulative runtime : 187549 msec
Total number of scriptcalls : 289705


Now, the runtime delta is only 510 (and from what I understand having it under 600 is good?)

What I am curious about is how the "Total Cumulative Runtime" and the "Total number of scriptcalls" should be read in correlation to the Runtime Delta. Are we running too many scripts, with too much total cumulative runtime even though we have a Runtime Delta of only 510msec?

Currently I have only a "overall statitics" log, but our server host/admin is going to run me some detailed reports so I can see the gory details behind our lag problem (I hope), but I wanted to make sure that I know what I am reading when I get it.

Also - Thanks for the great NWN tools you have put out over the years, its really appreciated by us other die-hard fans!
_________________
DM Jurivancer
Forgotten Realms Cormyr
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sat Jul 09, 2005 22:03    Post subject: Reply with quote

You could do some obvious math with the "total" values, but the really interesting values are the delta (to quickly find a section where a script ran wild) and then of course the number of calls per script and how long it took to run.

There is no absolute good or bad with scripts and runtime, some scripts are just heavy and cannot be optimized further. The Profiler is an invaluable tool for finding those 4-5 script that should not eat up CPU time at all, or for finding NPCs pathfinding in vain.

A delta value below 1 second per 10 seconds is what I'd consider normal and good, below 600msec is even better. The less time your scripts eat, the more time the server has for other things.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    nwnx.org Forum Index -> Scripts and Modules All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group