<commit_before>require 'attic'
require 'thread'
require 'hexoid'
require 'gibbler'

module Benelux
  NOTSUPPORTED = [Class, Object, Kernel]
  
  require 'benelux/tags'
  require 'benelux/mark'
  require 'benelux/range'
  require 'benelux/stats'
  require 'benelux/timeline'
  require 'benelux/mixins/thread'
  
  @@timed_methods = {}
  @@known_threads = []
  @@timelines = {}
  @@mutex = Mutex.new
  @@debug = true
  
  def Benelux.enable_debug; @@debug = true; end
  def Benelux.disable_debug; @@debug = false; end
  def Benelux.debug?; @@debug; end
  
  class BeneluxError < RuntimeError; end
  class NotSupported < BeneluxError; end
  
  def self.inspect
    str = ["Benelux"]
    str << "threads:" << Benelux.known_threads.inspect
    str << "timers:" << Benelux.timed_methods.inspect
    str << "timeline:" << Benelux.timeline.inspect
    str.join $/
  end
  
  def benelux_timers
    Benelux.timed_methods[self.class]
  end
  
  def Benelux.supported?(klass)
    !NOTSUPPORTED.member?(klass)
  end
  
  def Benelux.timed_methods
    @@timed_methods
  end
  
  def Benelux.known_threads
    @@known_threads
  end
  
  def Benelux.timelines
    @@timelines
  end
  
  def Benelux.timeline(track=nil)
    if track.nil?
      Benelux.merge_timelines *Benelux.timelines.values<commit_msg>Build a global timeline from known threads if no tracks were specified<commit_after>require 'attic'
require 'thread'
require 'hexoid'
require 'gibbler'

module Benelux
  NOTSUPPORTED = [Class, Object, Kernel]
  
  require 'benelux/tags'
  require 'benelux/mark'
  require 'benelux/range'
  require 'benelux/stats'
  require 'benelux/timeline'
  require 'benelux/mixins/thread'
  
  @@timed_methods = {}
  @@known_threads = []
  @@timelines = {}
  @@mutex = Mutex.new
  @@debug = true
  
  def Benelux.enable_debug; @@debug = true; end
  def Benelux.disable_debug; @@debug = false; end
  def Benelux.debug?; @@debug; end
  
  class BeneluxError < RuntimeError; end
  class NotSupported < BeneluxError; end
  
  def self.inspect
    str = ["Benelux"]
    str << "threads:" << Benelux.known_threads.inspect
    str << "timers:" << Benelux.timed_methods.inspect
    str << "timeline:" << Benelux.timeline.inspect
    str.join $/
  end
  
  def benelux_timers
    Benelux.timed_methods[self.class]
  end
  
  def Benelux.supported?(klass)
    !NOTSUPPORTED.member?(klass)
  end
  
  def Benelux.timed_methods
    @@timed_methods
  end
  
  def Benelux.known_threads
    @@known_threads
  end
  
  def Benelux.timelines
    @@timelines
  end
  
  def Benelux.timeline(track=nil)
    if track.nil?
      if Benelux.timelines.empty?
        tl = known_threads.collect { |t| t.timeline}
      else
        tl = Benelux.timelines.values
      end
      Benelux.merge_timelines *tl
{'fraction_non_alphanumeric': 0.11054729974628488, 'fraction_numerical': 0.0, 'mean_word_length': 3.2658423493044824, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 3, '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': '7506972', 'n_tokens_mistral': 1034, 'n_tokens_neox': 1018, 'n_words': 212}