sort_result();
 }
 
+static void print_bpf_events(int total, struct lock_contention_fails *fails)
+{
+       /* Output for debug, this have to be removed */
+       int broken = fails->task + fails->stack + fails->time;
+
+       if (quiet || total == 0 || (broken == 0 && verbose <= 0))
+               return;
+
+       total += broken;
+       pr_info("\n=== output for debug ===\n\n");
+       pr_info("bad: %d, total: %d\n", broken, total);
+       pr_info("bad rate: %.2f %%\n", (double)broken / (double)total * 100);
+
+       pr_info("histogram of failure reasons\n");
+       pr_info(" %10s: %d\n", "task", fails->task);
+       pr_info(" %10s: %d\n", "stack", fails->stack);
+       pr_info(" %10s: %d\n", "time", fails->time);
+}
 static void print_contention_result(struct lock_contention *con)
 {
        struct lock_stat *st;
        }
 
        bad = total = printed = 0;
-       if (use_bpf)
-               bad = bad_hist[BROKEN_CONTENDED];
 
        while ((st = pop_from_result())) {
                struct thread *t;
                        break;
        }
 
-       print_bad_events(bad, total);
+       if (use_bpf)
+               print_bpf_events(total, &con->fails);
+       else
+               print_bad_events(bad, total);
 }
 
 static bool force;
 
                lock_contention_stop();
                lock_contention_read(&con);
-
-               /* abuse bad hist stats for lost entries */
-               bad_hist[BROKEN_CONTENDED] = con.lost;
        } else {
                err = perf_session__process_events(session);
                if (err)
 
        fd = bpf_map__fd(skel->maps.lock_stat);
        stack = bpf_map__fd(skel->maps.stacks);
 
-       con->lost = skel->bss->lost;
+       con->fails.task = skel->bss->task_fail;
+       con->fails.stack = skel->bss->stack_fail;
+       con->fails.time = skel->bss->time_fail;
 
        stack_trace = zalloc(stack_size);
        if (stack_trace == NULL)
 
 int aggr_mode;
 
 /* error stat */
-int lost;
+int task_fail;
+int stack_fail;
+int time_fail;
 
 static inline int can_record(u64 *ctx)
 {
                bpf_map_update_elem(&tstamp, &pid, &zero, BPF_ANY);
                pelem = bpf_map_lookup_elem(&tstamp, &pid);
                if (pelem == NULL) {
-                       lost++;
+                       __sync_fetch_and_add(&task_fail, 1);
                        return 0;
                }
        }
                pelem->stack_id = bpf_get_stackid(ctx, &stacks,
                                                  BPF_F_FAST_STACK_CMP | stack_skip);
                if (pelem->stack_id < 0)
-                       lost++;
+                       __sync_fetch_and_add(&stack_fail, 1);
        } else if (aggr_mode == LOCK_AGGR_TASK) {
                struct task_struct *task;
 
                return 0;
 
        duration = bpf_ktime_get_ns() - pelem->timestamp;
+       if ((__s64)duration < 0) {
+               bpf_map_delete_elem(&tstamp, &pid);
+               __sync_fetch_and_add(&time_fail, 1);
+               return 0;
+       }
 
        switch (aggr_mode) {
        case LOCK_AGGR_CALLER: