Lines Matching refs:bit

225 	struct blk_io_trace *bit;  member
573 static void handle_notify(struct blk_io_trace *bit) in handle_notify() argument
575 void *payload = (caddr_t) bit + sizeof(*bit); in handle_notify()
578 switch (bit->action) { in handle_notify()
580 add_ppm_hash(bit->pid, payload); in handle_notify()
584 if (bit->pdu_len != sizeof(two32)) in handle_notify()
591 start_timestamp = bit->time; in handle_notify()
602 if (bit->pdu_len > 0) { in handle_notify()
603 char msg[bit->pdu_len+1]; in handle_notify()
605 memcpy(msg, (char *)payload, bit->pdu_len); in handle_notify()
606 msg[bit->pdu_len] = '\0'; in handle_notify()
610 MAJOR(bit->device), MINOR(bit->device), in handle_notify()
611 bit->cpu, "0", (int) SECONDS(bit->time), in handle_notify()
612 (unsigned long) NANO_SECONDS(bit->time), in handle_notify()
751 static inline void bit_free(struct blk_io_trace *bit) in bit_free() argument
753 if (bit_alloc_cache < 1024 && !bit->pdu_len) { in bit_free()
757 bit->time = (__u64) (unsigned long) bit_alloc_list; in bit_free()
758 bit_alloc_list = (struct blk_io_trace *) bit; in bit_free()
761 free(bit); in bit_free()
766 struct blk_io_trace *bit = bit_alloc_list; in bit_alloc() local
768 if (bit) { in bit_alloc()
770 bit->time; in bit_alloc()
772 return bit; in bit_alloc()
775 return malloc(sizeof(*bit)); in bit_alloc()
780 struct per_cpu_info *pci = get_cpu_info(pdi, t->bit->cpu); in __put_trace_last()
785 bit_free(t->bit); in __put_trace_last()
808 if (t->bit->time < __t->bit->time) in trace_rb_insert()
810 else if (t->bit->time > __t->bit->time) in trace_rb_insert()
812 else if (t->bit->device < __t->bit->device) in trace_rb_insert()
814 else if (t->bit->device > __t->bit->device) in trace_rb_insert()
816 else if (t->bit->sequence < __t->bit->sequence) in trace_rb_insert()
839 struct per_cpu_info *pci = get_cpu_info(pdi, t->bit->cpu); in trace_rb_insert_last()
867 if (device < __t->bit->device) in trace_rb_find()
869 else if (device > __t->bit->device) in trace_rb_find()
871 else if (sequence < __t->bit->sequence) in trace_rb_find()
873 else if (sequence > __t->bit->sequence) in trace_rb_find()
892 if (__t->bit->device == device && in trace_rb_find()
893 __t->bit->sequence == sequence) in trace_rb_find()
1168 static void check_time(struct per_dev_info *pdi, struct blk_io_trace *bit) in check_time() argument
1170 unsigned long long this = bit->time; in check_time()
1868 if (t->bit->time < genesis_time) in find_genesis()
1869 genesis_time = t->bit->time; in find_genesis()
1894 static inline int check_stopwatch(struct blk_io_trace *bit) in check_stopwatch() argument
1896 if (bit->time < stopwatch_end && in check_stopwatch()
1897 bit->time >= stopwatch_start) in check_stopwatch()
1917 struct blk_io_trace *bit = t->bit; in sort_entries() local
1921 bit->time -= genesis_time; in sort_entries()
1923 if (bit->time < *youngest || !*youngest) in sort_entries()
1924 *youngest = bit->time; in sort_entries()
1926 if (!pdi || pdi->dev != bit->device) { in sort_entries()
1927 pdi = get_dev_info(bit->device); in sort_entries()
1931 if (!pci || pci->cpu != bit->cpu) in sort_entries()
1932 pci = get_cpu_info(pdi, bit->cpu); in sort_entries()
1934 if (bit->sequence < pci->smallest_seq_read) in sort_entries()
1935 pci->smallest_seq_read = bit->sequence; in sort_entries()
1937 if (check_stopwatch(bit)) { in sort_entries()
1938 bit_free(bit); in sort_entries()
1968 cpu = __t->bit->cpu; in check_cpu_map()
1992 struct blk_io_trace *bit = t->bit; in check_sequence() local
1997 pci = get_cpu_info(pdi, bit->cpu); in check_sequence()
2004 if (bit->sequence == 1) in check_sequence()
2006 if (bit->sequence == pci->smallest_seq_read) in check_sequence()
2012 if (bit->sequence == expected_sequence) in check_sequence()
2030 if (check_current_skips(pci, bit->sequence)) in check_sequence()
2033 if (expected_sequence < bit->sequence) in check_sequence()
2034 insert_skip(pci, expected_sequence, bit->sequence - 1); in check_sequence()
2043 struct blk_io_trace *bit; in show_entries_rb() local
2052 bit = t->bit; in show_entries_rb()
2057 if (!pdi || pdi->dev != bit->device) { in show_entries_rb()
2058 pdi = get_dev_info(bit->device); in show_entries_rb()
2064 MAJOR(bit->device), MINOR(bit->device)); in show_entries_rb()
2071 if (!force && bit->time > last_allowed_time) in show_entries_rb()
2074 check_time(pdi, bit); in show_entries_rb()
2076 if (!pci || pci->cpu != bit->cpu) in show_entries_rb()
2077 pci = get_cpu_info(pdi, bit->cpu); in show_entries_rb()
2079 pci->last_sequence = bit->sequence; in show_entries_rb()
2083 if (bit->action & (act_mask << BLK_TC_SHIFT)) in show_entries_rb()
2084 dump_trace(bit, pci, pdi); in show_entries_rb()
2138 static inline __u16 get_pdulen(struct blk_io_trace *bit) in get_pdulen() argument
2141 return bit->pdu_len; in get_pdulen()
2143 return __bswap_16(bit->pdu_len); in get_pdulen()
2146 static inline __u32 get_magic(struct blk_io_trace *bit) in get_magic() argument
2149 return bit->magic; in get_magic()
2151 return __bswap_32(bit->magic); in get_magic()
2160 struct blk_io_trace *bit; in read_events() local
2165 bit = bit_alloc(); in read_events()
2169 ret = read_data(fd, bit, sizeof(*bit), should_block, fdblock); in read_events()
2171 bit_free(bit); in read_events()
2181 if (data_is_native == -1 && check_data_endianness(bit->magic)) in read_events()
2184 magic = get_magic(bit); in read_events()
2190 pdu_len = get_pdulen(bit); in read_events()
2192 void *ptr = realloc(bit, sizeof(*bit) + pdu_len); in read_events()
2194 if (read_data(fd, ptr + sizeof(*bit), pdu_len, 1, fdblock)) { in read_events()
2199 bit = ptr; in read_events()
2202 trace_to_cpu(bit); in read_events()
2204 if (verify_trace(bit)) { in read_events()
2205 bit_free(bit); in read_events()
2212 if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && bit->action != BLK_TN_MESSAGE) { in read_events()
2213 handle_notify(bit); in read_events()
2214 output_binary(bit, sizeof(*bit) + bit->pdu_len); in read_events()
2220 t->bit = bit; in read_events()
2226 if (!pdi || pdi->dev != bit->device) in read_events()
2227 pdi = get_dev_info(bit->device); in read_events()
2229 if (bit->time > pdi->last_read_time) in read_events()
2230 pdi->last_read_time = bit->time; in read_events()
2264 return ms_peek(msp)->bit->time; in ms_peek_time()
2318 struct blk_io_trace *bit = NULL; in ms_prime() local
2322 bit = bit_alloc(); in ms_prime()
2323 ret = read_data(pci->fd, bit, sizeof(*bit), 1, &pci->fdblock); in ms_prime()
2327 if (data_is_native == -1 && check_data_endianness(bit->magic)) in ms_prime()
2330 magic = get_magic(bit); in ms_prime()
2337 pdu_len = get_pdulen(bit); in ms_prime()
2339 void *ptr = realloc(bit, sizeof(*bit) + pdu_len); in ms_prime()
2340 ret = read_data(pci->fd, ptr + sizeof(*bit), pdu_len, in ms_prime()
2344 bit = NULL; in ms_prime()
2348 bit = ptr; in ms_prime()
2351 trace_to_cpu(bit); in ms_prime()
2352 if (verify_trace(bit)) in ms_prime()
2355 if (bit->action & BLK_TC_ACT(BLK_TC_NOTIFY) && bit->action != BLK_TN_MESSAGE) { in ms_prime()
2356 handle_notify(bit); in ms_prime()
2357 output_binary(bit, sizeof(*bit) + bit->pdu_len); in ms_prime()
2358 bit_free(bit); in ms_prime()
2364 if (bit->time > pdi->last_read_time) in ms_prime()
2365 pdi->last_read_time = bit->time; in ms_prime()
2369 t->bit = bit; in ms_prime()
2384 if (bit) bit_free(bit); in ms_prime()
2457 struct blk_io_trace *bit; in handle() local
2461 bit = t->bit; in handle()
2465 bit->time -= genesis_time; in handle()
2467 if (t->bit->time > stopwatch_end) in handle()
2470 pdi->last_reported_time = bit->time; in handle()
2471 if ((bit->action & (act_mask << BLK_TC_SHIFT))&& in handle()
2472 t->bit->time >= stopwatch_start) in handle()
2473 dump_trace(bit, pci, pdi); in handle()
2480 bit_free(t->bit); in handle()