#include <haproxy/api-t.h>
#include <haproxy/freq_ctr-t.h>
+#include <haproxy/tinfo-t.h>
/* bit fields for the "profiling" global variable */
#define HA_PROF_TASKS_OFF 0x00000000 /* per-task CPU profiling forced disabled */
unsigned long long alloc_tot;
unsigned long long free_tot;
void *info; // for pools, ptr to the pool
+ struct thread_exec_ctx exec_ctx;
};
#endif
bin = MEMPROF_HASH_BUCKETS;
goto leave;
}
- hash = _ptr_hash(ra);
- bin = _ptr_hash_reduce(hash, MEMPROF_HASH_BITS);
- for (; memprof_stats[bin].caller != ra; bin = (bin + (hash | 1)) & (MEMPROF_HASH_BUCKETS - 1)) {
+ hash = _ptr2_hash_arg(ra, th_ctx->exec_ctx.pointer, th_ctx->exec_ctx.type);
+ for (bin = _ptr_hash_reduce(hash, MEMPROF_HASH_BITS);
+ memprof_stats[bin].caller != ra ||
+ memprof_stats[bin].exec_ctx.type != th_ctx->exec_ctx.type ||
+ memprof_stats[bin].exec_ctx.pointer != th_ctx->exec_ctx.pointer;
+ bin = (bin + (hash | 1)) & (MEMPROF_HASH_BUCKETS - 1)) {
if (!--retries) {
bin = MEMPROF_HASH_BUCKETS;
break;
old = NULL;
if (!memprof_stats[bin].caller &&
HA_ATOMIC_CAS(&memprof_stats[bin].caller, &old, ra)) {
+ memprof_stats[bin].exec_ctx = th_ctx->exec_ctx;
memprof_stats[bin].method = meth;
break;
}
return -1;
else if (l->alloc_tot + l->free_tot < r->alloc_tot + r->free_tot)
return 1;
+ else if (l->exec_ctx.type > r->exec_ctx.type)
+ return -1;
+ else if (l->exec_ctx.type < r->exec_ctx.type)
+ return 1;
+ else if (l->exec_ctx.pointer > r->exec_ctx.pointer)
+ return -1;
+ else if (l->exec_ctx.pointer < r->exec_ctx.pointer)
+ return 1;
else
return 0;
}
return -1;
else if (l->caller < r->caller)
return 1;
+ else if (l->exec_ctx.type > r->exec_ctx.type)
+ return -1;
+ else if (l->exec_ctx.type < r->exec_ctx.type)
+ return 1;
+ else if (l->exec_ctx.pointer > r->exec_ctx.pointer)
+ return -1;
+ else if (l->exec_ctx.pointer < r->exec_ctx.pointer)
+ return 1;
else
return 0;
}