2013-04-11 20:07:18 +04:00
|
|
|
util-obj-y = osdep.o cutils.o unicode.o qemu-timer-common.o
|
2012-12-20 18:58:44 +04:00
|
|
|
util-obj-$(CONFIG_WIN32) += oslib-win32.o qemu-thread-win32.o event_notifier-win32.o
|
2013-06-05 18:44:54 +04:00
|
|
|
util-obj-$(CONFIG_POSIX) += oslib-posix.o qemu-thread-posix.o event_notifier-posix.o qemu-openpty.o
|
2014-09-03 07:44:56 +04:00
|
|
|
util-obj-y += envlist.o path.o module.o
|
|
|
|
util-obj-$(call lnot,$(CONFIG_INT128)) += host-utils.o
|
add hierarchical bitmap data type and test cases
HBitmaps provides an array of bits. The bits are stored as usual in an
array of unsigned longs, but HBitmap is also optimized to provide fast
iteration over set bits; going from one bit to the next is O(logB n)
worst case, with B = sizeof(long) * CHAR_BIT: the result is low enough
that the number of levels is in fact fixed.
In order to do this, it stacks multiple bitmaps with progressively coarser
granularity; in all levels except the last, bit N is set iff the N-th
unsigned long is nonzero in the immediately next level. When iteration
completes on the last level it can examine the 2nd-last level to quickly
skip entire words, and even do so recursively to skip blocks of 64 words or
powers thereof (32 on 32-bit machines).
Given an index in the bitmap, it can be split in group of bits like
this (for the 64-bit case):
bits 0-57 => word in the last bitmap | bits 58-63 => bit in the word
bits 0-51 => word in the 2nd-last bitmap | bits 52-57 => bit in the word
bits 0-45 => word in the 3rd-last bitmap | bits 46-51 => bit in the word
So it is easy to move up simply by shifting the index right by
log2(BITS_PER_LONG) bits. To move down, you shift the index left
similarly, and add the word index within the group. Iteration uses
ffs (find first set bit) to find the next word to examine; this
operation can be done in constant time in most current architectures.
Setting or clearing a range of m bits on all levels, the work to perform
is O(m + m/W + m/W^2 + ...), which is O(m) like on a regular bitmap.
When iterating on a bitmap, each bit (on any level) is only visited
once. Hence, The total cost of visiting a bitmap with m bits in it is
the number of bits that are set in all bitmaps. Unless the bitmap is
extremely sparse, this is also O(m + m/W + m/W^2 + ...), so the amortized
cost of advancing from one bit to the next is usually constant.
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2013-01-21 20:09:40 +04:00
|
|
|
util-obj-y += bitmap.o bitops.o hbitmap.o
|
2013-02-04 13:57:50 +04:00
|
|
|
util-obj-y += fifo8.o
|
2012-12-20 18:58:44 +04:00
|
|
|
util-obj-y += acl.o
|
|
|
|
util-obj-y += error.o qemu-error.o
|
|
|
|
util-obj-$(CONFIG_POSIX) += compatfd.o
|
2014-09-30 15:59:30 +04:00
|
|
|
util-obj-y += id.o
|
2012-12-20 18:58:44 +04:00
|
|
|
util-obj-y += iov.o aes.o qemu-config.o qemu-sockets.o uri.o notify.o
|
|
|
|
util-obj-y += qemu-option.o qemu-progress.o
|
2013-03-15 20:41:58 +04:00
|
|
|
util-obj-y += hexdump.o
|
2013-04-29 22:48:16 +04:00
|
|
|
util-obj-y += crc32c.o
|
2013-09-02 16:14:37 +04:00
|
|
|
util-obj-y += throttle.o
|
2013-06-04 22:24:49 +04:00
|
|
|
util-obj-y += getauxval.o
|
2013-11-14 14:54:15 +04:00
|
|
|
util-obj-y += readline.o
|
2014-03-03 14:30:03 +04:00
|
|
|
util-obj-y += rfifolock.o
|
2013-05-13 15:29:47 +04:00
|
|
|
util-obj-y += rcu.o
|