Examples of ProfilerEvent


Examples of com.mysql.jdbc.profiler.ProfilerEvent

            mesgBuf.append(this.originalSql);
            mesgBuf.append("\n\n with parameters bound:\n\n");
            mesgBuf.append(asSql(true));

            this.eventSink
                .consumeEvent(new ProfilerEvent(
                    ProfilerEvent.TYPE_SLOW_QUERY,
                    "", this.currentCatalog, this.connection.getId(), //$NON-NLS-1$
                    getId(), 0, System.currentTimeMillis(),
                    elapsedTime, mysql
                        .getQueryTimingUnits(), null,
                    new Throwable(), mesgBuf.toString()));
          }

          if (gatherPerformanceMetrics) {
            this.connection.registerQueryExecutionTime(elapsedTime);
          }
        }

        this.connection.incrementNumberOfPreparedExecutes();

        if (this.profileSQL) {
          this.eventSink = ProfilerEventHandlerFactory
              .getInstance(this.connection);

          this.eventSink.consumeEvent(new ProfilerEvent(
              ProfilerEvent.TYPE_EXECUTE,
              "", this.currentCatalog, //$NON-NLS-1$
              this.connectionId, this.statementId, -1, System
                  .currentTimeMillis(), (int) (mysql
                  .getCurrentTimeNanosOrMillis() - begin),
              mysql.getQueryTimingUnits(), null, new Throwable(),
              truncateQueryToLog(asSql(true))));
        }
 
        com.mysql.jdbc.ResultSetInternalMethods rs = mysql.readAllResults(this,
            maxRowsToRetrieve, this.resultSetType,
            this.resultSetConcurrency, createStreamingResultSet,
            this.currentCatalog, resultPacket, true, this.fieldCount,
            metadataFromCache);
       
        if (mysql.shouldIntercept()) {
          ResultSetInternalMethods interceptedResults =
              mysql.invokeStatementInterceptorsPost(this.originalSql, this, rs, true, null);
   
            if (interceptedResults != null) {
              rs = interceptedResults;
            }
        }
       
        if (this.profileSQL) {
          long fetchEndTime = mysql.getCurrentTimeNanosOrMillis();

          this.eventSink.consumeEvent(new ProfilerEvent(
              ProfilerEvent.TYPE_FETCH,
              "", this.currentCatalog, this.connection.getId(), //$NON-NLS-1$
              getId(), 0 /* FIXME rs.resultId */, System.currentTimeMillis(),
              (fetchEndTime - queryEndTime), mysql
                  .getQueryTimingUnits(), null,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.