<commit_before>package lila.fishnet

import org.joda.time.DateTime
import reactivemongo.bson._
import scala.concurrent.duration._

import lila.db.Implicits._

private final class Monitor(
    repo: FishnetRepo,
    sequencer: Sequencer,
    scheduler: lila.common.Scheduler) {

  private[fishnet] def analysis(work: Work, client: Client, result: JsonApi.Request.PostAnalysis) = {
    success(work, client)
    val monitor = lila.mon.fishnet.analysis by client.userId.value
    monitor move result.analysis.size
    result.engine.options.hashInt foreach { monitor.hash(_) }
    result.engine.options.threadsInt foreach { monitor.threads(_) }
    val nbSamples = (result.analysis.size / 8) min 10
    sample(result.analysis.filterNot(_.checkmate), nbSamples).foreach { move =>
      move.time foreach { monitor.movetime(_) }
      move.nodes foreach { monitor.node(_) }
      move.nps foreach { monitor.nps(_) }
      move.depth foreach { monitor.depth(_) }
      monitor pvSize move.pvList.size
    }
  }

  private[fishnet] def move(work: Work, client: Client) = {
    success(work, client)
    if (work.level == 8) work.acquiredAt foreach { acquiredAt =>
      lila.mon.fishnet.move.time(client.userId.value)(nowMillis - acquiredAt.getMillis)<commit_msg>fishnet: refine types<commit_after>package lila.fishnet

import org.joda.time.DateTime
import reactivemongo.bson._
import scala.concurrent.duration._

import lila.db.Implicits._

private final class Monitor(
    repo: FishnetRepo,
    sequencer: Sequencer,
    scheduler: lila.common.Scheduler) {

  private[fishnet] def analysis(work: Work.Analysis, client: Client, result: JsonApi.Request.PostAnalysis) = {
    success(work, client)
    val monitor = lila.mon.fishnet.analysis by client.userId.value
    monitor move result.analysis.size
    result.engine.options.hashInt foreach { monitor.hash(_) }
    result.engine.options.threadsInt foreach { monitor.threads(_) }
    val nbSamples = (result.analysis.size / 8) min 10
    sample(result.analysis.filterNot(_.checkmate), nbSamples).foreach { move =>
      move.time foreach { monitor.movetime(_) }
      move.nodes foreach { monitor.node(_) }
      move.nps foreach { monitor.nps(_) }
      move.depth foreach { monitor.depth(_) }
      monitor pvSize move.pvList.size
    }
  }

  private[fishnet] def move(work: Work.Move, client: Client) = {
    success(work, client)
    if (work.level == 8) work.acquiredAt foreach { acquiredAt =>
      lila.mon.fishnet.move.time(client.userId.value)(nowMillis - acquiredAt.getMillis)
{'fraction_non_alphanumeric': 0.11492890995260663, 'fraction_numerical': 0.00315955766192733, 'mean_word_length': 3.6820702402957486, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '2350578', 'n_tokens_mistral': 802, 'n_tokens_neox': 789, 'n_words': 169}