Re: [PATCH v2 1/2] KVM: selftests: Provide generic way to read system counter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vipin Sharma <vipinsh@xxxxxxxxxx> writes:

On Thu, Mar 16, 2023 at 3:29 PM Colton Lewis <coltonlewis@xxxxxxxxxx> wrote:

Provide a generic function to read the system counter from the guest
for timing purposes. A common and important way to measure guest
performance is to measure the amount of time different actions take in
the guest. Provide also a mathematical conversion from cycles to
nanoseconds and a macro for timing individual statements.

Substitute the previous custom implementation of a similar function in

May be specify specific name:  guest_read_system_counter()

Will do.

+#define MEASURE_CYCLES(x)                      \
+       ({                                      \
+               uint64_t start;                 \
+               start = cycles_read();          \
+               x;                              \
+               cycles_read() - start;          \
+       })
+

MEASURE_CYCLES should be moved to the next patch where it is getting
used. Does it have to be macro or can it be replaced with a function?

Will move to the next patch. It can't be replaced by a function because
then 'x' would be executed before the function begins and there would be
nothing left to measure.




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux