Export (0) Print
Expand All

__lwpins32, __lwpins64

Visual Studio 2010

Visual Studio 2010 SP1 is required.

Microsoft Specific

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
);

[in] data2

A 32 or 64-bit parameter that will be written to the Data2 field of an LWP ring buffer record.

[in] data1

A 32-bit parameter that will be written to the Data1 field of an LWP ring buffer record.

[in] flags

A 32-bit parameter from which the bottom 16 bits will be written to the Flags field of an LWP ring buffer record.

An unsigned character that has the value 1 if the ring buffer was full, 0 otherwise.

Intrinsic

Architecture

__llwpins32

LWP

__llwpins64

LWP, X64 only

Header file <intrin.h>

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[2] (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[0](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.

Community Additions

ADD
Show:
© 2014 Microsoft