Return-Path: william@bourbon.usc.edu Delivery-Date: Thu Sep 18 11:03:49 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8II3n6x028999 for ; Thu, 18 Sep 2008 11:03:49 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8II5GZH021563 for ; Thu, 18 Sep 2008 11:05:16 -0700 Message-Id: <200809181805.m8II5GZH021563@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Confusing use round()? Date: Thu, 18 Sep 2008 11:05:16 -0700 From: Bill Cheng Someone wrote: > The spec. said > > * please use select() (or equivalent) to sleep for a specified > number of *microseconds*. > > and system should printout > > 00000312.112ms: c1 arrives, inter-arrival time = *312.112*ms > > > I know spec. said round inter-arrival and service times to the nearest > millisecond, but it looks like most time values should be narrow to > microseconds not millisecond. When an arrival thread of a service thread sleeps, you should ask it to sleep for an integral number of *milliseconds*. Therefore, if your calculation determines that the duration you should sleep is not an integral number of milliseconds, you should use the round() macro. When you *measure* anything, you must use *microsecond* resolution and report exactly what you have measured (and not what you think the value *should be*). That's why the printout has microsecond resolution. > Does it mean we use round() on Statistics calculation? It's not necessary. -- Bill Cheng // bill.cheng@usc.edu