Visual Studio 2010 SP1 is required.
Generates the lightweight profiling (LWP) instruction lwpins to insert a user event record with into the active LWP ring buffer.
unsigned char __lwpins32( unsigned int data2, unsigned int data1, unsigned int flags ); unsigned char __lwpins64( unsigned __int64 data2, unsigned int data1, unsigned int flags );
These intrinsics can be used to record important events with EventId 255 in the lightweight profiling ring buffer. Unlike lwpval, the lwpins instruction writes to the buffer each time it is executed. See __lwpval32 for more information.
When lightweight profiling is enabled, these intrinsics immediately write a record into the next available slot of the active LWP ring buffer and return 0. If the ring buffer is full, the new record overwrites the last record in the buffer and the intrinsic returns 1. When lightweight profiling is not enabled, these intrinsics silently return 0.
Both __lwpins32 and __lwpins64 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 __lwpins32 intrinsic sets bytes 23-20 of the ring buffer record to zero.
The lwpins 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. 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.