The signature for calloc is void *calloc(size_t num, size_t size), where num
is the number of elements to allocate, and size is the size. Therefore, to
allocate a single struct, we should pass 1 for num and the size of the struct
as size.
In some places, we use the opposite order, and we should flip it.
Before, if the size is exactly the multiple of the page size, an extra padding
page is added for no reason. This commit fixes the logic and also uses the
page size obtained dynamically.
This is currently only implemented for Linux.
On Windows, ShellExecute should be used, but that should be done when it's
actually needed so it could be tested.
We used to increment the source buffer index by width * bpp, not by pitch.
This is incorrect and the root cause behind #670.
This is a regression that appeared in 196050bd23.
We now enumerate all IVSHMEM devices, sort them based on PCI bus, slot,
and function numbers, then index from the resulting order. This should
be consistent across boots.
To help the user identify the correct IVSHMEM device, we also print the
list of IVSHMEM devices on startup.
When our window is destroyed, our timers are also destroyed. This causes our
attempt at destruction to fail. Instead, set MessageHWND to NULL in the
WM_DESTROY handler and don't try destroying the timers if the window is gone.
This allows us to set a callback to read a value out before it's about
to be overwritten which can be useful for things like calculating a
running average.
This so called "enhanced" event logic is completely flawed and can never
work correctly, better to strip it out and put our faith in windows to
handle the events for us.
And yes, I am fully aware I wrote the utter trash in the first place :)
Due to a failure to understand atomics when this code was originally
written it has a critical flaw with the fast path where an event could
be signalled when it should not be. This change set corrects this issue
by using atomic operations.
People often miss the warnings about invalid arguments in their command
line, this last minute patch attempts to address this by making
warnings, errors, fixme's and fatal errors stand out if stdout is a TTY.
We receive values as int64_t, but when we compute the sum, we store it as
int. This doesn't make sense as we eventually cast it to double when
computing the average. We should instead store the sum as int64_t.
Extensive profiling reveals that the glibc memcpy performs up to 2x
faster then the existing SIMD implementation that was in use here. This
patch also will copy large 1MB chunks if the pitch of the source and
destination match further increasing throughput.