<commit_before>#!python

import csv

from collections import deque


trace_file = sys.argv[1]



hits = 0
misses = 0

class SlabClass:
  def __init__(self, chk):
    self.chunk_size = chk
    self.slabs = [Slab(chk, 0)]
  eviction_queue = deque()
  hits=0
  slabs=1
  def add_slab ():
    self.slabs.append(Slab(self.chunk_size, ++slabs))
  def kill_slab (sid):
    self.slabs.remove(sid)

class Slab:
  def __init__(self, chk, sid):
    self.chunk_size = chk
    self.id = sid
  def __eq__(self, other):
    return self.sid == other.sid
  objs_cached=0
  bytes_cached=0
  hits=0
  def frag ():
    return 1 - (bytes_cached/(objs_cached * chunk_size))

class DataObj:
  def __init__(self, ksz, vsz)
    self.ksz = ksz
    self.vsz = vsz
  def size ():
    return ksz + vsz


<commit_msg>added request class and parsing into<commit_after>#!python

import sys
import csv


from collections import deque


  

trace_file = sys.argv[1]



hits = 0
misses = 0

class Request:
  def __init__ (self, time, appid, typ, ksz, vsz, kid, hit):
    self.time = time
    self.appid = appid
    self.typ = typ
    self.ksz = ksz
    self.vsz = vsz
    self.kid = kid
    self.hit = hit
  def printReq (self) :
    print "%f %d %d %d %d %d %d" %(self.time, self.appid, self.typ, self.ksz, 
    self.vsz, self.kid, self.hit) 

with open(trace_file, 'rb') as tf:
  reader = csv.reader(tf, delimiter=',')
  for rw in reader:
    req = Request(float(rw[0]),int(rw[1]),int(rw[2]),int(rw[3]),int(rw[4]),
    int(rw[5]),int(rw[6]))
    req.printReq()   


class SlabClass:
  def __init__(self, chk):
    self.chunk_size = chk
    self.slabs = [Slab(chk, 0)]
  eviction_queue = deque()
  hits=0
  slabs=1
  def add_slab (self):
    self.slabs.append(Slab(self.chunk_size, ++slabs))
  def kill_slab (self,sid):
    self.slabs.remove(sid)

class Slab:
  def __init__(self, chk, sid):
    self.chunk_size = chk
    self.id = sid
  def __eq__(self, other):
    return self.sid == other.sid
  objs_cached=0
  bytes_cached=0
  hits=0
  def frag ():
    return 1 - (bytes_cached/(objs_cached * chunk_size))

class DataObj:
  def __init__(self, ksz, vsz, objid):
    self.ksz = ksz
    self.vsz = vsz
    self.objid = objid
  def __eq__(self, other):
    return self.objid == other.objid
  def size (self):
    return ksz + vsz
  


{'fraction_non_alphanumeric': 0.13478260869565217, 'fraction_numerical': 0.011739130434782608, 'mean_word_length': 3.0157068062827226, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6571934', 'n_tokens_mistral': 953, 'n_tokens_neox': 931, 'n_words': 228}