mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-12-28 02:00:34 -07:00
Sometimes it is useful to have a quick histogram to represent a certain
distribution -- for example, when investigating a performance regression
in a hash table due to inadequate hashing.
The appended allows us to easily represent a distribution using Unicode
characters. Further, the data structure keeping track of the distribution
is so simple that obtaining its values for off-line processing is trivial.
Example, taking the last 10 commits to QEMU:
Characters in commit title Count
-----------------------------------
39 1
48 1
53 1
54 2
57 1
61 1
67 1
78 1
80 1
qdist_init(&dist);
qdist_inc(&dist, 39);
[...]
qdist_inc(&dist, 80);
char *str = qdist_pr(&dist, 9, QDIST_PR_LABELS);
// -> [39.0,43.6)▂▂ █▂ ▂ ▄[75.4,80.0]
g_free(str);
char *str = qdist_pr(&dist, 4, QDIST_PR_LABELS);
// -> [39.0,49.2)▁█▁▁[69.8,80.0]
g_free(str);
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Emilio G. Cota <cota@braap.org>
Message-Id: <1465412133-3029-9-git-send-email-cota@braap.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
|
||
|---|---|---|
| .. | ||
| acl.c | ||
| base64.c | ||
| bitmap.c | ||
| bitops.c | ||
| buffer.c | ||
| compatfd.c | ||
| coroutine-gthread.c | ||
| coroutine-sigaltstack.c | ||
| coroutine-ucontext.c | ||
| coroutine-win32.c | ||
| crc32c.c | ||
| cutils.c | ||
| envlist.c | ||
| error.c | ||
| event_notifier-posix.c | ||
| event_notifier-win32.c | ||
| fifo8.c | ||
| getauxval.c | ||
| hbitmap.c | ||
| hexdump.c | ||
| host-utils.c | ||
| id.c | ||
| iov.c | ||
| log.c | ||
| Makefile.objs | ||
| memfd.c | ||
| mmap-alloc.c | ||
| module.c | ||
| notify.c | ||
| osdep.c | ||
| oslib-posix.c | ||
| oslib-win32.c | ||
| path.c | ||
| qdist.c | ||
| qemu-config.c | ||
| qemu-coroutine-io.c | ||
| qemu-coroutine-lock.c | ||
| qemu-coroutine-sleep.c | ||
| qemu-coroutine.c | ||
| qemu-error.c | ||
| qemu-openpty.c | ||
| qemu-option.c | ||
| qemu-progress.c | ||
| qemu-sockets.c | ||
| qemu-thread-posix.c | ||
| qemu-thread-win32.c | ||
| qemu-timer-common.c | ||
| rcu.c | ||
| readline.c | ||
| rfifolock.c | ||
| throttle.c | ||
| timed-average.c | ||
| unicode.c | ||
| uri.c | ||