Logo Search packages:      
Sourcecode: sbnc version File versions  Download package

const char * CCore::DebugImpulse ( int  impulse  ) 

DebugImpulse

Executes a debug command.

Parameters:
impulse the command

Definition at line 1568 of file Core.cpp.

References CUser::GetClientConnectionMultiplexer(), CUser::GetIRCConnection(), GetUsers(), CIRCConnection::ParseLine(), and hash_t< Type >::Value.

Referenced by CClientConnection::ProcessBncCommand().

                                           {
      if (impulse == 6) {
            int a = 23, b = 0, c;
            
            c = a / b;
      }

      if (impulse == 7) {
            _exit(0);
      }

      if (impulse == 12) {
            int i = 0;
            hash_t<CUser *> *User;
            static char *Out = NULL;
            unsigned int diff;

            while ((User = g_Bouncer->GetUsers()->Iterate(i++)) != NULL) {
                  if (User->Value->GetClientConnectionMultiplexer() == NULL && User->Value->GetIRCConnection() != NULL) {
                        CIRCConnection *IRC = User->Value->GetIRCConnection();

#ifndef _WIN32
                        timeval start, end;

                        gettimeofday(&start, NULL);
#else
                        DWORD start, end;

                        start = GetTickCount();
#endif

#define BENCHMARK_LINES 2000000

                        for (int a = 0; a < BENCHMARK_LINES; a++) {
                              IRC->ParseLine(":fakeserver.performance-test PRIVMSG #random-channel :abcdefghijklmnopqrstuvwxyz");
                        }

#ifndef _WIN32
                        gettimeofday(&end, NULL);
                        diff = ((end.tv_sec - start.tv_sec) * 1000000 + end.tv_usec - start.tv_usec) / 1000;
#else
                        end = GetTickCount();
                        diff = end - start;
#endif

                        unsigned int lps = BENCHMARK_LINES / diff;

                        free(Out);

                        asprintf(&Out, "%d lines parsed in %d msecs, approximately %d lines/msec", BENCHMARK_LINES, diff, lps);

                        return Out;
                  }
            }
      }

      return NULL;
}


Generated by  Doxygen 1.6.0   Back to index