Open howfars opened 4 years ago
Thanks for your question. I think your understanding of our intent for sleep_time
is correct. However, notice that the red box part of the code is in a while loop. What we did was simulate the sleep until the time has passed (in the trace file). Basically, we jump forward the pointer in the trace file (mahimahi_ptr
) until the sleep time is up. In this process, the sleep_time
may be up in the middle of of a trace row. Thus you see a break and the last_mahimahi_time
to remember the fraction time.
Overall, this goal of part of the function isn't to "return a sleep_time", rather to simulate the sleep process when buffer exceeds the threshold.
Hope these help!
Hi, Hongzi I can't understand the calculation method of the
sleep_time
in thesim/fixed_env.py
. When the buffer size is larger than theBUFFER_THRESH
,we need to sleep until the buffer size is less than theBUFFER_THRESH
.And then we need to skip some "durations" in the trace file.I understand this process. But I don't understand the code with red box in the pic above.Using this code, thesleep_time
in the return value isn't the originalsleep_time
(code in green box), but the originalsleep_time
minus several "duration" time. Howerver, I think thesleep_time
in the return value should be the originalsleep_time
in the green box,because actually we sleep that long,isn't it? I'm not sure about this question,can you help me?Look forward to your reply.Thank you.