Visual Studio 2010 SP1 is required.
Generates the lightweight profiling (LWP) instruction lwpval to insert a value sample record into the active LWP ring buffer.
void __lwpval32( unsigned int data2, unsigned int data1, unsigned int flags ); void __lwpval64( unsigned __int64 data2, unsigned int data1, unsigned int flags );
A 32 or 64-bit parameter that will be written to the Data2 field of an LWP ring buffer record.
A 32-bit parameter that will be written to the Data1 field of an LWP ring buffer record.
A 32-bit parameter from which the bottom 16 bits will be written to the Flags field of an LWP ring buffer record.
LWP, X64 only
Header file <intrin.h>
These intrinsics can be used to record value samples with EventID 1 in the lightweight profiling ring buffer. Unlike lwpins, the lwpval instruction only writes to the buffer every kth time lwpval is executed, where k-1 is the value of the EventInterval1 field of the LWPCB. See __lwpins32 for more information.
When a record is written, it goes into the next available slot of the active LWP ring buffer. If the ring buffer is full, the new record overwrites the last record in the buffer. When lightweight profiling is not enabled or LWP is enabled but the Programmed Value Sample event is not enabled, these intrinsics have no effect on the ring buffer.
Both __lwpval32 and __lwpval64 write the value of data2 to the Data2 field of the ring buffer record (bytes 23-16), data1 to the Data1 field (bytes 7-4), and flags to the Flags field (bytes 3-2). Note that flags must be constant and will be truncated to 16 bits. The __lwpval32 intrinsic sets bytes 23-20 of the ring buffer record to zero.
The lwpval instruction is part of the LWP family of instructions The LWP instructions require both hardware and operating system support. To determine hardware support for LWP, call the __cpuid intrinsic with InfoType = 0x80000001 and check bit 15 of CPUInfo (ECX). This bit is 1 when LWP is supported, and 0 otherwise. Once you know that LWP is supported by the processor, call the __cpuid intrinsic with InfoType = 0x8000001C and check bit 0 of CPUInfo(EAX). This bit is 1 if the operating system also supports LWP, 0 otherwise. If the operating system does support LWP, then check bit 1 of CPUInfo(EAX), which will be 1 if the LWPVAL instruction is available. This __cpuid test also returns additional information about the LWP implementation. See __llwpcb and AMD's "Lightweight Profiling Specification" (Publication Number 43724) for more information.
For an example, see __llwpcb.