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

 
Post new topic   Reply to topic    nwnx.org Forum Index -> General Discussion
View previous topic :: View next topic  
Author Message
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Oct 04, 2005 0:31    Post subject: Profiler Reply with quote

I make new module with location where is one NPC.
In onspawn have my testing script, I wanted try what is better for optimization scripts. But ...

I run server once and nwnx_profiler.txt write:
my_script 15731msec 1calls*

At second start without changes in module there was modification:
my_script 10528msec 1calls*

How is it possible, or on what depends time to do a script?

ShaDoOoW
Back to top
View user's profile Send private message
monezz



Joined: 03 Jan 2005
Posts: 52
Location: The Netherlands

PostPosted: Tue Oct 04, 2005 2:04    Post subject: Reply with quote

A lot of things are influencing performance.
cpu, disk io, swapping, (with a database: table size, indexing etc) etc

If you are testing performance on a certain script, make sure to measure the execution time several times. After a few runs (say 10-20) you can calculate the average execution time. If there are really high or low values (compared to the rest) you could eliminate them from the average.

Do the same for your new script to see if performance increases.

If you use a database like MySQL, you could tune your queries seperatly on the mysql command prompt. Try to add some index combinations on search keys and watch the execution times.
Back to top
View user's profile Send private message Visit poster's website
ShaDoOoW



Joined: 20 Aug 2005
Posts: 584

PostPosted: Tue Oct 04, 2005 17:09    Post subject: Reply with quote

ok and when i run server all script take the same time to do. So when i run server and there will be time to do 1 script less than average that means that this run will best for start module becose all scripts take less time ?
Back to top
View user's profile Send private message
monezz



Joined: 03 Jan 2005
Posts: 52
Location: The Netherlands

PostPosted: Tue Oct 04, 2005 18:12    Post subject: Reply with quote

I'm sorry but I don't understand what you mean.
Back to top
View user's profile Send private message Visit poster's website
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Tue Oct 04, 2005 23:25    Post subject: Reply with quote

Uh, how do you make a script run for 15 seconds ? I would really like to know how you got around the TMI limit for that long Shocked.

On the other hand: Your operating system is a multitasking one, and if scripts take THAT long to execute, it will suspend nwserver.exe every nn milliseconds (10-75ms, not sure, just an estimate) and run something else. That time counts towards the script execution time as well. Especially the NWN client is notorious for stealing CPU time from the server, try to give nwserver.exe a higher priority with the Windows task manager.

Note: Normally, scripts take not more than a couple of milliseconds and therefore the profiler does not take task switches into account.
_________________
Papillon
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Thu Oct 06, 2005 9:23    Post subject: Re: Profiler Reply with quote

ShaDoOoW wrote:
I make new module with location where is one NPC.
In onspawn have my testing script, I wanted try what is better for optimization scripts. But ...

I run server once and nwnx_profiler.txt write:
my_script 15731msec 1calls*

At second start without changes in module there was modification:
my_script 10528msec 1calls*

How is it possible, or on what depends time to do a script?

ShaDoOoW


The first time through the database (MySQL) will do something called 'Parsing'. This is when it comes across a sql statement for the first time. It then 'caches' (records) this sql for next time.

So the second time through it finds that it has already run the sql statement and bypasses the 'parsing' by looking up what it did last time.

*Grossly oversimplified*

And Yes, approx 1/3 of processing a SQL statement is 'parsing' especially when running 'single row result' queries.

This help?

Gryphyn
Back to top
View user's profile Send private message
Winlok



Joined: 03 Aug 2006
Posts: 3

PostPosted: Thu Aug 03, 2006 22:04    Post subject: Reply with quote

I thought I would put this in this topic since it's what I wanted to speak about.

I downloaded NWNX and NWNX Profiler, with the intent purposes of running scripts to see how hoggish they were.

I plop NWNX.2, NWNX.ini, nwnx-module.dll, madCHook.dll, and nwnx-profiler.dll in the NWN directory, but it appears I'm doing something wrong or not right.

This is what I get all the time
http://ca.geocities.com/c.palm@rogers.com/Image1.gif
which is pretty grainy. If you can't see what is happening I will try and clean it up.

I don't see any statistics like I had hoped. Very Happy
Back to top
View user's profile Send private message
Acrodania



Joined: 02 Jan 2005
Posts: 208

PostPosted: Thu Aug 03, 2006 22:09    Post subject: Reply with quote

First, did you add the script hooks into the module? That is still needed.

Second, the results are logged into a txt file in your logs.0 directory. You simply open that text file to see the results. They do NOT show in the graphical interface; way too much data is being saved too often Smile
Back to top
View user's profile Send private message
Winlok



Joined: 03 Aug 2006
Posts: 3

PostPosted: Fri Aug 04, 2006 1:26    Post subject: Reply with quote

[Thu Aug 03 15:05:22] Loading Module: ATEST
[Thu Aug 03 15:05:22]---- Server Options ----
Max Players: 6
Char Levels: (1-40)
Player Password: NO
DM Login Enabled: YES
Server Admin Login Enabled: YES
Post Game To Internet: YES
Game Type: Action
Difficulty: 2
PVP Setting: PARTY
Vault: LOCAL
Only One Party: YES
Enforce Legal Characters: YES
Item Level Restrictions: NO
Player pausing: DISABLED
Auto Save: Enabled
Saving Characters in Saved Game
---- End Server Options ----
[Thu Aug 03 15:06:42] Server Shutting Down


Thanks for the reply. I trust that this log file will change dramatically when I put in the script hooks. Which leads me to my next question. Where do I get script hooks, and do I put them in the NWN directory with the rest. Very Happy

First, did you add the script hooks into the module? That is still needed

Just thought I'd mention this although if it's really obvious, sorry I said anything. According to the instructions for the NWNX2 program and the profiler itself. I couldn't find anywhere, where it said to do anything other then put the files I mentioned in the NWN directory.
Back to top
View user's profile Send private message
Winlok



Joined: 03 Aug 2006
Posts: 3

PostPosted: Fri Aug 04, 2006 19:12    Post subject: additional Reply with quote

Winlok wrote:
[Thu Aug 03 15:05:22] Loading Module: ATEST
[Thu Aug 03 15:05:22]---- Server Options ----
Max Players: 6
Char Levels: (1-40)
Player Password: NO
DM Login Enabled: YES
Server Admin Login Enabled: YES
Post Game To Internet: YES
Game Type: Action
Difficulty: 2
PVP Setting: PARTY
Vault: LOCAL
Only One Party: YES
Enforce Legal Characters: YES
Item Level Restrictions: NO
Player pausing: DISABLED
Auto Save: Enabled
Saving Characters in Saved Game
---- End Server Options ----
[Thu Aug 03 15:06:42] Server Shutting Down


Thanks for the reply. I trust that this log file will change dramatically when I put in the script hooks. Which leads me to my next question. Where do I get script hooks, and do I put them in the NWN directory with the rest. Very Happy

First, did you add the script hooks into the module? That is still needed

Just thought I'd mention this although if it's really obvious, sorry I said anything. According to the instructions for the NWNX2 program and the profiler itself. I couldn't find anywhere, where it said to do anything other then put the files I mentioned in the NWN directory.


I have done some more reading, and as you can tell I'm not terribly initiated. Now my intention was to run a script and see how much resources it was using. I see a lot of references to SQLite? and Persistent Worlds.

These are not for a PW. I barely have time for a single player. I don't know what script hooks are, or how to implement them with the profiler. Is this really for me? Very Happy
Back to top
View user's profile Send private message
Gryphyn



Joined: 20 Jan 2005
Posts: 431

PostPosted: Sat Aug 05, 2006 1:25    Post subject: Re: additional Reply with quote

Quote:
I have done some more reading, and as you can tell I'm not terribly initiated. Now my intention was to run a script and see how much resources it was using. I see a lot of references to SQLite? and Persistent Worlds.

These are not for a PW. I barely have time for a single player. I don't know what script hooks are, or how to implement them with the profiler. Is this really for me? Very Happy


You are looking at the nwserverLog?.txt you should be looking for a file nwnx_profiler.txt This is the file that will have the statistics you are looking for. (providing you have the profiler plugin setup)

Cheers
Gryphyn
Back to top
View user's profile Send private message
Papillon
x-man


Joined: 28 Dec 2004
Posts: 1060
Location: Germany

PostPosted: Sun Aug 06, 2006 13:26    Post subject: Reply with quote

No script hooking necessary for the profiler. Just run your module using nwserver with the nwnx stuff installed, and check out the logfile nwnx_profiler.txt in one of the logs.0,1,2 directories...
_________________
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 -> General Discussion 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