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