iowatcher: Make seconds unsigned
[blktrace.git] / iowatcher / blkparse.c
index 43630be44ad904f9323af7c6221f23d4d0f33e99..c9ae3e7409668d22a39e393d1786adecc5779592 100644 (file)
@@ -12,7 +12,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  *
  *  Parts of this file were imported from Jens Axboe's blktrace sources (also GPL)
  */
@@ -181,12 +181,10 @@ struct pid_map {
        char name[0];
 };
 
-#define MINORBITS 20
-#define MINORMASK ((1 << MINORBITS) - 1)
-#define SECONDS(x)              ((unsigned long long)(x) / 1000000000)
-#define NANO_SECONDS(x)         ((unsigned long long)(x) % 1000000000)
-#define DOUBLE_TO_NANO_ULL(d)   ((unsigned long long)((d) * 1000000000))
-#define CHECK_MAGIC(t)          (((t)->magic & 0xffffff00) == BLK_IO_TRACE_MAGIC)
+u64 get_record_time(struct trace *trace)
+{
+       return trace->io->time;
+}
 
 void init_io_hash_table(void)
 {
@@ -960,9 +958,6 @@ void add_tput(struct trace *trace, struct graph_line_data *writes_gld,
                gld = writes_gld;
 
        seconds = SECONDS(io->time);
-       if (seconds > gld->max_seconds)
-               return;
-
        gld->data[seconds].sum += io->bytes;
 
        gld->data[seconds].count = 1;
@@ -1043,7 +1038,7 @@ void add_io(struct trace *trace, struct trace_file *tf)
 
 void add_pending_io(struct trace *trace, struct graph_line_data *gld)
 {
-       int seconds;
+       unsigned int seconds;
        struct blk_io_trace *io = trace->io;
        int action = io->action & BLK_TA_MASK;
        double avg;
@@ -1060,10 +1055,6 @@ void add_pending_io(struct trace *trace, struct graph_line_data *gld)
        if (action != __BLK_TA_ISSUE)
                return;
 
-       seconds = SECONDS(io->time);
-       if (seconds > gld->max_seconds)
-               return;
-
        pio = hash_dispatched_io(trace->io);
        if (!pio)
                return;
@@ -1075,6 +1066,7 @@ void add_pending_io(struct trace *trace, struct graph_line_data *gld)
 
        ios_in_flight++;
 
+       seconds = SECONDS(io->time);
        gld->data[seconds].sum += ios_in_flight;
        gld->data[seconds].count++;
 
@@ -1138,9 +1130,6 @@ void add_iop(struct trace *trace, struct graph_line_data *gld)
                return;
 
        seconds = SECONDS(io->time);
-       if (seconds > gld->max_seconds)
-               return;
-
        gld->data[seconds].sum += 1;
        gld->data[seconds].count = 1;
        if (gld->data[seconds].sum > gld->max)