Zeex / samp-plugin-profiler

Performance profiler plugin for SA-MP server
http://forum.sa-mp.com/showthread.php?t=271129
BSD 2-Clause "Simplified" License
46 stars 8 forks source link

No output from profiler #19

Open matbcvo opened 9 years ago

matbcvo commented 9 years ago

Profiler 2.12.1 Linux 3.10.23-xxxx-std-ipv6-64 on x86_64 CentOS Linux 6.6

Gamemode is compiled with -d3 flag.

http://prntscr.com/7mbhki

server.cfg

lanmode 0 rcon_password t287f maxplayers 200 port 7777 hostname Imperial Roleplay gamemode0 imperial filterscripts fix plugins crashdetect.so sscanf.so mysql.so streamer.so timerfix.so audio.so MapAndreas.so YSF.so bcrypt-samp.so gvar.so imrp_ol.so nativechecker.so profiler.so announce 1 query 1 weburl www.im-rp.eu maxnpc 25 onfoot_rate 40 incar_rate 40 weapon_rate 40 stream_distance 300.0 stream_rate 1000 messageholelimit 3000 logtimeformat [%d.%m.%Y %H:%M:%S] language Eesti keel profile_gamemode 1

Some plugin version: GVar Plugin v1.3 by Incognito loaded plugin.bcrypt v2.2.3 was loaded. YSF - kurta999 version R12 loaded Audio Plugin v0.5 R2 by Incognito loaded plugin.mysql: R39-3 successfully loaded. Streamer Plugin v2.7.7 by Incognito loaded CrashDetect v4.15.1 is OK.

[profiler] Attached profiler to gamemodes/imperial.amx

What's the problem?

karimcambridge commented 8 years ago

Same issue. No output on linux. On windows it creates the output file but it just creates the heading only.

IstuntmanI commented 8 years ago

Same issue ! On Windows I think it's working ok, as long as gmx or exit is used. But on linux it is more like random: 1 out of 1000 times it is actually creating the .html file in the gamemodes folder. xD

I really need this plugin, it is really useful, but this bug is really annoying, I wasn't able to use profiler for a long time due to this problem. Everytime I tried this problem occured.

At first, I thought that it was because I was also using crashdetect, and then I removed it, and at the first gmx it printed out well, but after that it still wasn't printing anything.

IstuntmanI commented 8 years ago

It looks like using Profiler_Dump is working. This is the only solution I see for now: when we want to see the dump file we have to use a command to generate the file. (bad if we forget to use it before a restart)

karimcambridge commented 8 years ago

Profiler_Dump didnt work for me.

Zeex commented 8 years ago

I've added a little more logging, it may shed some light on what's going on. Can you please try the new version? (you'll need to build from source)

karimcambridge commented 8 years ago

Profiler_Start doesn't work.

[17/03/2016 07:07:59] Loading plugin: profiler [17/03/2016 07:07:59] Profiler v2.13-6 is OK. [17/03/2016 06:53:27] [profiler] Attached profiler to gamemodes/Kcnr.amx (no debug info) [17/03/2016 07:09:03] [profiler] Dumping profiling statistics for gamemodes/Kcnr [17/03/2016 07:09:03] [profiler] Total functions logged: 0 (native: 0, public: 0, other: 0) [17/03/2016 07:09:03] [profiler] Total function calls logged: 0 [17/03/2016 07:09:04] [profiler] Writing profile to gamemodes/Kcnr-profile.html

#if defined PROFILER_INC
        case MENU_ADMINCP_PROFILING:
        {
            switch(option)
            {
                case 1: SendClientMessageFormatted(playerid, -1, "Current Profiler State: %d.", Profiler_GetState());
                case 2: {
                    SendClientMessageFormatted(playerid, -1, "Profiler Started: %d.", Profiler_Start());
                }
                case 3: {
                    if(Profiler_GetState() != _:PROFILER_STARTED) {
                        return sendClientError(playerid, "The profiler can not be stopped at the moment (it is not in started state).");
                    }
                    SendClientMessageFormatted(playerid, -1, "Profiler Stopped: %d.", Profiler_Stop());
                }
                case 4: SendClientMessageFormatted(playerid, -1, "Profiler Dumped: %d.", Profiler_Dump());
            }
        }
        #endif

Whenever I select Profiler_Start the profiler state stays in 3 (attached) even after waiting and waiting.

It also doesn't print anything.

This was annoying me so I went to the Profiler::Start() function and added Printf("Start() %d. %d.", state_, PROFILER_ATTACHED); and it printed 3. 2. which means PROFILER_STARTING state... good.

BUT I can't seem to see where Profiler::Exec is ever executed so I just did (for a temp fix.. tho this fix starts profiling on game mode start, which should really be an option)

bool Profiler::Start() {
  if (state_ < PROFILER_ATTACHED) {
    state_ = PROFILER_ATTACHING;
    return true;
  }
  if (state_ >= PROFILER_ATTACHED) {
    //state_ = PROFILER_STARTING;
    CompleteStart();
    return true;
  }
  return false;
}

and fixed!

Zeex commented 8 years ago

It should transition from STARTING to STARTED on the next call to some public function (i.e. next time amx_Exec is called by the server). It's strange that this didn't work...

Edit:

Can you see if Exec is called at all? E.g. put a print in it like you did with Start().

karimcambridge commented 8 years ago

Exec It's called during filterscripts loading

[17/03/2016 19:00:19]  Loaded 10 plugins.

[17/03/2016 19:00:19] 
[17/03/2016 19:00:19] Filterscripts
[17/03/2016 19:00:19] ---------------
[17/03/2016 19:00:19]   Loading filterscript 'rconfix.amx'...
[17/03/2016 19:00:19] [profiler] Profiler::Exec (state: 0)
[17/03/2016 19:00:19] [profiler] 2 Profiler::Exec (state: 0)
[17/03/2016 19:00:19] 
--RCON Fix FS loaded.

It aint called after that.

the first print is the start of the function, the second one is the end of the function (Profiler::Exec).