<commit_before># Copyright (c) 2011-2013 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYRIGHT file.

# HONE application
# Distributed Rate Limiting

from hone_lib import *
from math import *
import time

_DRL_DEBUG_ = False

K = 0.2
totalBudget = 100000 # Kbps

def query():
    q = (Select(['app','srcHost', 'srcIP','srcPort','dstIP','dstPort','BytesSentOut','StartTimeSecs','ElapsedSecs','StartTimeMicroSecs','ElapsedMicroSecs']) *
         From('HostConnection') *
         Where([('app', '==', 'trafclient')]) *
         Every(2000))
    return q

''' tpData[(srcIP,srcPort,dstIP,dstPort)] = (lastTimestamp, lastAccumulativeBytesSent, lastThroughput) '''
def CalThroughput(newData, oldData):
    (hostId, tpData) = oldData
    if _DRL_DEBUG_:
        fileOutput = open('tmp_drl.log', 'a')
        print >>fileOutput, 'CalThroughput'
        print >>fileOutput, 'before start'<commit_msg>change drl to 1 second<commit_after># Copyright (c) 2011-2013 <NAME>. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYRIGHT file.

# HONE application
# Distributed Rate Limiting

from hone_lib import *
from math import *
import time

_DRL_DEBUG_ = False

K = 0.2
totalBudget = 100000 # Kbps

def query():
    q = (Select(['app','srcHost', 'srcIP','srcPort','dstIP','dstPort','BytesSentOut','StartTimeSecs','ElapsedSecs','StartTimeMicroSecs','ElapsedMicroSecs']) *
         From('HostConnection') *
         Where([('app', '==', 'trafclient')]) *
         Every(1000))
    return q

''' tpData[(srcIP,srcPort,dstIP,dstPort)] = (lastTimestamp, lastAccumulativeBytesSent, lastThroughput) '''
def CalThroughput(newData, oldData):
    (hostId, tpData) = oldData
    if _DRL_DEBUG_:
        fileOutput = open('tmp_drl.log', 'a')
        print >>fileOutput, 'CalThroughput'
        print >>fileOutput, 'before start'
{'fraction_non_alphanumeric': 0.14130995358432183, 'fraction_numerical': 0.021144920061887573, 'mean_word_length': 4.34435261707989, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '7280308', 'n_tokens_mistral': 667, 'n_tokens_neox': 615, 'n_words': 163}