<commit_before>package com.yammer.dropwizard.experiments

import java.util.concurrent.{TimeUnit, Executors}
import com.yammer.metrics.Instrumented
import com.yammer.metrics.reporting.ConsoleReporter
import org.eclipse.jetty.server._
import org.mockito.Mockito._
import org.eclipse.jetty.http.{HttpFields, HttpURI}
import com.yammer.dropwizard.jetty.AsyncRequestLog

object LogThroughputRunner extends Instrumented {
  val timer = metrics.timer("log", durationUnit = TimeUnit.MICROSECONDS)

  class LogWriter(log: RequestLog) extends Runnable {
    val fields = new HttpFields

    val conn = mock(classOf[HttpConnection])
    when(conn.getRequestFields).thenReturn(fields)

    val request = new Request(conn)
    request.setRemoteAddr("127.0.0.1")
    request.setUri(new HttpURI("/one/two/three"))
    request.setMethod("GET")
    request.setProtocol("HTTP/1.1")

    val response = new Response(conn)
    response.setStatus(200)

    def run() {
      try {
        for (i <- 1 to 10000) {
          timer.time { log.log(request, response) }
        }
      } catch {
        case e => e.printStackTrace()
      }
    }
  }

  def newLog() = {
//    new NCSARequestLog("./logs/ncsa_request_log_yyyy_mm_dd.log")<commit_msg>Fix LogThroughputRunner for Jetty 7.6.0.<commit_after>package com.yammer.dropwizard.experiments

import java.util.concurrent.{TimeUnit, Executors}
import com.yammer.metrics.Instrumented
import com.yammer.metrics.reporting.ConsoleReporter
import org.eclipse.jetty.server._
import org.mockito.Mockito._
import org.eclipse.jetty.http.{HttpFields, HttpURI}
import com.yammer.dropwizard.jetty.AsyncRequestLog

object LogThroughputRunner extends Instrumented {
  val timer = metrics.timer("log", durationUnit = TimeUnit.MICROSECONDS)

  class LogWriter(log: RequestLog) extends Runnable {
    val fields = new HttpFields

    val conn = mock(classOf[AbstractHttpConnection])
    when(conn.getRequestFields).thenReturn(fields)

    val request = new Request(conn)
    request.setRemoteAddr("127.0.0.1")
    request.setUri(new HttpURI("/one/two/three"))
    request.setMethod("GET")
    request.setProtocol("HTTP/1.1")

    val response = new Response(conn)
    response.setStatus(200)

    def run() {
      try {
        for (i <- 1 to 10000) {
          timer.time { log.log(request, response) }
        }
      } catch {
        case e => e.printStackTrace()
      }
    }
  }

  def newLog() = {
//    new NCSARequestLog("./logs/ncsa_request_log_yyyy_mm_dd.log")
{'fraction_non_alphanumeric': 0.11639146194120016, 'fraction_numerical': 0.014901329037454692, 'mean_word_length': 3.5328467153284673, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5664625', 'n_tokens_mistral': 844, 'n_tokens_neox': 795, 'n_words': 149}