# SQLite Export Schema Reference

This section describes in-depth exported data types. Since the tool is still BETA, please note, that the format may likely change in the future. Also, not every exported field may have been documented at this time.

Schema for a concrete database can be obtained with the sqlite3 tool built-in command .schema:

    sqlite> .schema
    CREATE TABLE StringIds (id INTEGER PRIMARY KEY, value TEXT NOT NULL);
    CREATE TABLE SCHED_EVENTS (id INTEGER PRIMARY KEY AUTOINCREMENT, start INT NOT NULL, cpu INT NOT NULL, isSchedIn INT NOT NULL, globalTid INT NOT NULL);
    CREATE TABLE sqlite_sequence(name,seq);
    CREATE TABLE COMPOSITE_EVENTS (id INT NOT NULL PRIMARY KEY, start INT NOT NULL, cpu INT NOT NULL, threadState INT NOT NULL, globalTid INT NOT NULL, cpuCycles INT NOT NULL);
    ...

Tables are created lazily, therefore not every table described below might be present in a particular report.

Current logic behind the chosen layout is that each data type gets it’s own table in the exported database. Since usage patterns for exported data may vary greatly and no default use cases has been established yet, no indexes or extra constraints are created. Instead, refer to the Examples section for list of common recipes.

Due to current limitations, all fields are declared as NOT NULL, even where actual value may be missing, instead default value for that field is exported. This might change in future versions.

## CUDA

See https://docs.nvidia.com/cuda/cupti/index.html for a detatiled information on collected event and data types.

### Runtime API

Table name | CUPTI_ACTIVITY_KIND_RUNTIME
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Use this value to find events in `CUPTI_ACTIVITY_KIND_KERNEL`, `CUPTI_ACTIVITY_KIND_MEMSET`, `CUPTI_ACTIVITY_KIND_MEMCPY`, tables that this function call has triggered. For an example refer to Transfer CUDA kernel names onto API ranges.
nameId | INT NOT NULL | StringId of function name.
returnValue | INT NOT NULL | Return value of function call.

### CuBLAS events

Table name | CUBLAS_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT | Serialized GlobalId.
nameId | INT NOT NULL | StringId of function name.

### CuDNN events

Table name | CUDNN_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT | Serialized GlobalId.
nameId | INT NOT NULL | StringId of function name.

### CUDA graph node creation events

See mapping API calls to graph node creation for an example.

Table name | CUDA_GRAPH_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT | Serialized GlobalId.
nameId | INT NOT NULL REFERENCES StringIds | StringId of “Graph Node Creation” string.
graphNodeId | INT NOT NULL | CUDA graph node creation id.
originalGraphNodeId | INT | In case the node was cloned, this field will reference the original graph node id.

### Kernel events

Table name | CUPTI_ACTIVITY_KIND_KERNEL
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
deviceId | INT NOT NULL | The ID of the device where the kernel is executing.
contextId | INT NOT NULL | The ID of the context where the kernel is executing.
streamId | INT NOT NULL | The ID of the stream where the kernel is executing.
correlationId | INT | Use this value to find events in `CUPTI_ACTIVITY_KIND_RUNTIME` table that triggered execution of given kernel. For an example refer to Transfer CUDA kernel names onto API ranges.
globalPid | INT | Serialized GlobalId.
demangledName | INT NOT NULL | StringId of kernel name.
shortName | INT NOT NULL | StringId of short (without arguments) function name.
launchType | INT | The indicates if the kernel was executed via a regular launch or via a single/multi device cooperative launch.
cacheConfig | INT | The cache configuration used for the kernel. The value is one of the CUfunc_cache enumeration values from cuda.h.
registersPerThread | INT NOT NULL | The number of registers required for each thread executing the kernel.
gridX | INT NOT NULL | The X-dimension grid size for the kernel.
gridY | INT NOT NULL | The Y-dimension grid size for the kernel.
gridZ | INT NOT NULL | The Z-dimension grid size for the kernel.
blockX | INT NOT NULL | The X-dimension block size for the kernel.
blockY | INT NOT NULL | The Y-dimension block size for the kernel.
blockZ | INT NOT NULL | The Z-dimension block size for the kernel.
staticSharedMemory | INT NOT NULL | The static shared memory allocated for the kernel, in bytes.
dynamicSharedMemory | INT NOT NULL | The dynamic shared memory reserved for the kernel, in bytes.
localMemoryPerThread | INT NOT NULL | The amount of local memory reserved for each thread, in bytes.
localMemoryTotal | INT NOT NULL | The total amount of local memory reserved for the kernel, in bytes.
gridId | INT NOT NULL | The grid ID of the kernel. Each kernel is assigned a unique grid ID at runtime.
sharedMemoryExecuted | INT | Shared memory size set by the driver.
graphNodeId | INT | CUDA graph node creation id.

### Memset Events

Table name | CUPTI_ACTIVITY_KIND_MEMSET
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
deviceId | INT NOT NULL | The ID of the device where the memory set is occurring.
contextId | INT NOT NULL | The ID of the context where the memory set is occurring.
streamId | INT NOT NULL | The ID of the stream where the memory set is occurring.
correlationId | INT | Use this value to find events in `CUPTI_ACTIVITY_KIND_RUNTIME` table that triggered execution of given memory operation.
globalPid | INT | Serialized GlobalId.
value | INT NOT NULL | The value being assigned to memory by the memory set.
bytes | INT NOT NULL | The number of bytes being set by the memory set.
graphNodeId | INT | CUDA graph node creation id.
memKind | INT | The type of memory being set. See CUpti_ActivityMemoryKind

### Memcpy Events

Table name | CUPTI_ACTIVITY_KIND_MEMCPY
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
deviceId | INT NOT NULL | The ID of the device where the memory copy is occurring.
contextId | INT NOT NULL | The ID of the context where the memory copy is occurring.
streamId | INT NOT NULL | The ID of the stream where the memory copy is occurring.
correlationId | INT | Use this value to find events in `CUPTI_ACTIVITY_KIND_RUNTIME` table that triggered execution of given memory operation.
globalPid | INT | Serialized GlobalId.
bytes | INT NOT NULL | The number of bytes transferred by the memory copy.
copyKind | INT NOT NULL | The kind of the memory copy.
srcId | INT | The ID of the source CPU/device involved in the memory transfer, page fault, thrashing, throttling or remote map operation.
srcKind | INT | The source memory kind read by the memory copy. See CUpti_ActivityMemoryKind.
dstKind | INT | The destination memory kind read by the memory copy. See CUpti_ActivityMemoryKind.
srcDeviceId | INT | The ID of the device where memory is being copied from.
srcContextId | INT | The ID of the context owning the memory being copied from.
dstDeviceId | INT | The ID of the device where memory is being copied to.
dstContextId | INT | The ID of the context owning the memory being copied to.
graphNodeId | INT | CUDA graph node creation id.

### Synchronization Events

Table name | CUPTI_ACTIVITY_KIND_SYNCHRONIZATION
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
deviceId | INT NOT NULL | The ID of the device where the memory set is occurring.
contextId | INT NOT NULL | The ID of the context for which the synchronization API is called. In case of context synchronization API it is the context id for which the API is called. In case of stream/event synchronization it is the ID of the context where the stream/event was created.
streamId | INT NOT NULL | The compute stream for which the synchronization API is called.
correlationId | INT | The correlation ID of the API to which this result is associated.
globalPid | INT | Serialized GlobalId.
syncType | INT NOT NULL | The CUpti_ActivitySynchronizationType type of record.
eventId | INT NOT NULL | The event ID for which the synchronization API is called.

## NVTX

All NVTX events are collected in a single table. Differentiate between marks, start/end and push/pop ranges by the eventType column.

Table name | NVTX_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT | Event end timestamp in nanoseconds. End timestamp is not available, if event is atomic like Mark, or has not completed before the end of profiling.
eventType | INT NOT NULL | Event type enum value.
rangeId | INT | The correlation ID returned from a nvtxRangeStart call. Available for start/end ranges only.
text | TEXT | Optional text message for a given event.
category | INT | User-controlled ID that can be used to group events.
color | INT | Encoded ARGB color value.
globalTid | INT | Serialized GlobalId.
endGlobalTid | INT | Serialized GlobalId. Available when start/end range has ended on a thread other than the one it started on.
textId | INT | StringId of NVTX domain registered strings.
domainId | INT | User-controlled ID that can be used to group events.
uint64Value | INT | One of possible payload value union members.
int64Value | INT | One of possible payload value union members.
doubleValue | REAL | One of possible payload value union members.
uint32Value | INT | One of possible payload value union members.
int32Value | INT | One of possible payload value union members.
floatValue | REAL | One of possible payload value union members.
jsonTextId | INT | One of possible payload value union members.
jsonText | INT | One of possible payload value union members.

### NVTX eventType values

- 33 - NvtxCategory
- 34 - NvtxMark
- 39 - NvtxThread
- 59 - NvtxPushPopRange
- 60 - NvtxStartEndRange
- 75 - NvtxDomainCreate
- 76 - NvtxDomainDestroy

### Difference between text and textId columns

If an NVTX event message was passed via call to `nvtxDomainRegisterString` function, then the message will be available through `textId` field, otherwise the `text` field will contain the message if it was provided.

## OpenGL

Table name | OPENGL_API, OPENGL_WORKLOAD
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT NOT NULL | Serialized GlobalId.
nameId | INT NOT NULL | StringId of function name.
returnValue | INT NOT NULL | Return value of function call.

## OS Runtime Libraries Trace

OS runtime libraries can be traced to gather information about low-level userspace APIs. This traces the system call wrappers and thread synchronization interfaces exposed by the C runtime and POSIX Threads (pthread) libraries. This does not perform a complete runtime library API trace, but instead focuses on the functions that can take a long time to execute, or could potentially cause your thread be unscheduled from the CPU while waiting for an event to complete.

OSRT events may have callchains attached to them, depending on selected profiling settings. In such cases, one can use callchainId column to select relevant callchains from OSRT_CALLCHAINS table, refer to OSRT Callchains for an example.

Table name | OSRT_API
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT NOT NULL | Serialized GlobalId.
nameId | INT NOT NULL | StringId of function name.
returnValue | INT NOT NULL | Return value of function call.
callchainId | INT NOT NULL | De facto FOREIGN KEY to OSRT_CALLCHAINS.id. The value of 0 is used instead of NULL.

### OSRT Callchains

Table name | OSRT_CALLCHAINS
--- | ---
Column Name | Column Type | Column Description
id | INT NOT NULL | Part of PRIMARY KEY (id, stackDepth). Maps to OSRT_API.callchainId.
stackDepth | INT NOT NULL | Zero-base index of given function in call stack.
symbol | INT NOT NULL | StringId of function name.
module | INT NOT NULL | StringId of module name.

## Profiler Overhead

Table name | PROFILER_OVERHEAD
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT NOT NULL | Serialized GlobalId.
nameId | INT NOT NULL | StringId of function name.
returnValue | INT NOT NULL | Return value of function call.

## Sched events

Thread scheduling events, refer to Thread Summary for an example.

Table name | SCHED_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
cpu | INT NOT NULL | Id of CPU this thread was scheduled in or out.
isSchedIn | INT NOT NULL | 0 if thread was scheduled out, non-zero - otherwise.
globalTid | INT NOT NULL | Serialized GlobalId.

## Composite events

Thread sampling events, refer to Thread Summary for an example.

Table name | COMPOSITE_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
cpu | INT NOT NULL | Id of CPU this thread was running on.
threadState | INT NOT NULL | Thread state at the moment of sampling.
globalTid | INT NOT NULL | Serialized GlobalId.
cpuCycles | INT NOT NULL | The value of Performance Monitoring Unit (PMU) counter.

### Sampling callchains

Callchain entries obtained from composite events, used to construct function table views. Refer to Function table for an example.

Table name | SAMPLING_CALLCHAINS
--- | ---
Column Name | Column Type | Column Description
id | id INT NOT NULL REFERENCES COMPOSITE_EVENTS | Foreign key on COMPOSITE_EVENTS.id. Used to select call stack entries for a given composite event.
stackDepth | INT NOT NULL | Zero-base index of given function in call stack.
symbol | INT NOT NULL | StringId of function name.
module | INT NOT NULL | StringId of module name.

## DX12 events

Table name | DX12_API, DX12_WORKLOAD
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | DX12 event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | First ID in range of correlation values matching an API call to GPU workloads.
endCorrelationId | INT | Last ID in range of correlation values matching an API call to GPU workloads.
nameId | INT NOT NULL | StringId of function name.
shortContextId | INT | Short form of COM interface object address, either D3D12CommandQueue or D3D12GraphicsCommandList.
longContextId | INT | Long form of COM interface object address, either D3D12CommandQueue or D3D12GraphicsCommandList.
frameId | INT | Index of graphics frame. Frame 1 is the first frame in the trace session.
color | INT | Color assigned by the user code to a PIX performance marker.
textId | INT | StringId of text string assigned by the user code to a PIX performance marker.
commandListType | INT | See D3D12CommandList documentation for type enumeration.
objectName | INT | StringId of a name assigned by the user code to a D3D12 object.

### DX12 event class values

- 41 - TRACE_PROCESS_EVENT_DX12_API
- 42 - TRACE_PROCESS_EVENT_DX12_WORKLOAD
- 43 - TRACE_PROCESS_EVENT_DX12_START
- 44 - TRACE_PROCESS_EVENT_DX12_FINISH
- 52 - TRACE_PROCESS_EVENT_DX12_DISPLAY
- 59 - TRACE_PROCESS_EVENT_DX12_CREATE_OBJECT
- 65 - TRACE_PROCESS_EVENT_DX12_DEBUG_API

## Vulkan events

Table name | VULKAN_API
--- | ---
Column Name | Column Type | Column Description
id | INT NOT NULL PRIMARY KEY | An event ID used to query related records in VULKAN_PIPELINE_CREATION_EVENTS.
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | Vulkan event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | First ID in range of correlation values matching an API call to GPU workloads.
endCorrelationId | INT | Last ID in range of correlation values matching an API call to GPU workloads.
nameId | INT NOT NULL | StringId of function name.
contextId | INT | Short form of interface object address, either VkDevice, VkInstance, VkQueue, VkDeviceMemory, VkEvent or VkCommandBuffer.

Table name | VULKAN_PIPELINE_CREATION_EVENTS
--- | ---
Column Name | Column Type | Column Description
id | INT NOT NULL PRIMARY KEY | An ID used to query related records in VULKAN_PIPELINE_STAGE_EVENTS.
duration | INT | Event duration in nanoseconds.
flags | INT | Vulkan flags value.
traceEventId | INT REFERENCES VULKAN_API | Foreign key on VULKAN_API.id.

Table name | VULKAN_PIPELINE_STAGE_EVENTS
--- | ---
Column Name | Column Type | Column Description
duration | INT | Event duration in nanoseconds.
flags | INT | Vulkan flags value.
creationEventId | INT REFERENCES VULKAN_PIPELINE_CREATION_EVENTS | Foreign key on VULKAN_PIPELINE_CREATION_EVENTS.id.

Table name | VULKAN_WORKLOAD
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | Vulkan event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | First ID in range of correlation values matching an API call to GPU workloads.
endCorrelationId | INT | Last ID in range of correlation values matching an API call to GPU workloads.
nameId | INT NOT NULL | StringId of function name.
contextId | INT | Short form of interface object address, either VkDevice, VkInstance, VkQueue, VkDeviceMemory, VkEvent or VkCommandBuffer.

### Vulkan event class values

- 53 - TRACE_PROCESS_EVENT_VULKAN_API
- 54 - TRACE_PROCESS_EVENT_VULKAN_WORKLOAD
- 55 - TRACE_PROCESS_EVENT_VULKAN_START
- 56 - TRACE_PROCESS_EVENT_VULKAN_FINISH
- 60 - TRACE_PROCESS_EVENT_VULKAN_CREATE_OBJECT
- 66 - TRACE_PROCESS_EVENT_VULKAN_DEBUG_API

### Vulkan flags

- VALID_BIT = 0x00000001
- CACHE_HIT_BIT = 0x00000002
- BASE_PIPELINE_ACCELERATION_BIT = 0x00000004

## GPU context switch events

Table name | FECS_EVENTS
--- | ---
Column Name | Column Type | Column Description

tag

INT NOT NULL

Context switch event type. Supported values are:

- 7 - END
- 8 - START

vmId | INT NOT NULL | Serialized GlobalId.
seqNo | INT NOT NULL | Sequential event number used to detect buffer overflow and loss of events.
contextId | INT NOT NULL | Internal ID of the graphics context.
timestamp | INT NOT NULL | Event start timestamp in nanoseconds.
globalPid | INT | Serialized GlobalId.
gpuId | INT | Serialized GlobalId.

## SLI events

Table name | SLI_QUERIES |
--- | --- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | SLI event class enum value.
globalTid | INT | Serialized GlobalId.
gpu | INT | GPU index.
frameId | INT | Index of graphics frame. Frame 1 is the first frame in the trace session.
occQueryIssued | INT | Occlusion query issued.
occQueryAsked | INT | Occlusion query asked.
eventQueryIssued | INT | Event query issued.
eventQueryAsked | INT | Event query asked.
numberOfTransferEvents | INT | Number of transfer events.
amountOfTransferredData | INT | Cumulative size of resource data that was transferred.

Table name | SLI_P2P |
--- | --- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | SLI event class enum value.
globalTid | INT | Serialized GlobalId.
gpu | INT | GPU index.
frameId | INT | Index of graphics frame. Frame 1 is the first frame in the trace session.
transferSkipped | INT NOT NULL | Number of transfers that were skipped.
srcGpu | INT NOT NULL | Source GPU id.
dstGpu | INT NOT NULL | Destination GPU id.
numSubresources | INT NOT NULL | Number of sub resources to transfer.
resourceSize | INT NOT NULL | Size of resource.
subresourceIdx | INT NOT NULL | Sub resource index.
smplWidth | INT | The sub-resource surface width in samples.
smplHeight | INT | The sub-resource surface height in samples.
smplDepth | INT | The sub-resource surface depth in samples.
bytesPerElement | INT | Number of bytes per element.
dxgiFormat | INT | Resource data format. See DXGI_FORMAT enumeration.
logSurfaceNames | TEXT | Surface name.
transferInfo | INT | SLI transfer info enum value.
isEarlyPushManagedByNVAPI | INT | Is early push managed by NVAPI. 0 = False, 1 = True.
useAsyncP2PForResolve | INT | Use async Peer-to-Peer for resolve. 0 = False, 1 = True.
transferFuncName | TEXT | “A - BE” for asynchronous transfer, “S - BE” for synchronous transfer.
regimeName | TEXT | Name of the regime scope that includes the resource. The name is assigned in the application code.
debugName | TEXT | Debug name assigned to the resource by the application code.
bindType | TEXT | Bind type.

Table name | SLI_STATS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | SLI event class enum value.
globalTid | INT | Serialized GlobalId.
gpu | INT | GPU index.
countComplexFrames | INT NOT NULL | Complex frames count.
countStats | INT NOT NULL | Number of frame statistics collected so far for the inactive-time histogram.
totalInactiveTime | INT NOT NULL | Total inactive time. Units = microseconds.
minPBSize | INT NOT NULL | Min push buffer size.
maxPBSize | INT NOT NULL | Max push buffer size.
totalPBSize | INT NOT NULL | Total push buffer size.

### SLI event class values

- 62 - TRACE_PROCESS_EVENT_SLI
- 63 - TRACE_PROCESS_EVENT_SLI_START
- 64 - TRACE_PROCESS_EVENT_SLI_FINISH

### SLI transfer info values

- 0 - P2P_SKIPPED
- 1 - P2P_EARLY_PUSH
- 2 - P2P_PUSH_FAILED
- 3 - P2P_2WAY_OR_PULL
- 4 - P2P_PRESENT
- 5 - P2P_DX12_INIT_PUSH_ON_WRITE

## Event Tracing for Windows (ETW)

Table name | ETW_EVENTS
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
globalTid | INT | Serialized GlobalId.
providerName | INT | StringId of tracing events provider name.
taskName | INT | StringId of event task name.
description | INT | StringId of decoded event value.

## OpenMP Events

### Thread Event

Table name | OPENMP_EVENT_KIND_THREAD
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
threadId | INT | Internal thread sequence starting from 1. Note that this is not the OS thread Id.
threadType | INT | OpenMP thread type enum value. See https://www.openmp.org/spec-html/5.0/openmpsu185.html#x233-11730004.4.4.10

### Parallel Event

Table name | OPENMP_EVENT_KIND_PARALLEL
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parallelId | INT | Internal parallel region sequence starting from 1.
parentTaskId | INT | Id for task that creates this parallel region.

### SyncRegion/SyncRegionWait Event

Table name | OPENMP_EVENT_KIND_SYNC_REGION / OPENMP_EVENT_KIND_SYNC_REGION_WAIT
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parallelId | INT | Id of parallel region that this event belongs to.
taskId | INT | Id of task that this event belongs to.
kind | INT | OpenMP sync region kind enum value. See https://www.openmp.org/spec-html/5.0/openmpsu185.html#x233-11830004.4.4.13.

### Task Event

Table name | OPENMP_EVENT_KIND_TASK
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Use this value to find events in `OPENMP_EVENT_KIND_TASK` table that are different parts (generated due to task switching) of the same task.
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parallelId | INT | Id of parallel region that this task belongs to.
taskId | INT | Internal task sequence starting from 1.
kind | INT | OpenMP task kind enum value.

### Master Event

Table name | OPENMP_EVENT_KIND_MASTER
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parallelId | INT | Id of parallel region that this region belongs to.
taskId | INT | Id of task that this region belongs to.

### Reduction Event

Table name | OPENMP_EVENT_KIND_REDUCTION
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parallelId | INT | Id of parallel region that this region belongs to.
taskId | INT | Id of task that this region belongs to.

### Task Create Event

Table name | OPENMP_EVENT_KIND_TASK_CREATE
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Use this value to find events in `OPENMP_EVENT_KIND_TASK` table that are created by this event.
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parentTaskId | INT | Id of parent task that is creating a new task.
newTaskId | INT | Id of new task that is being created.

### Task Schedule Event

Table name | OPENMP_EVENT_KIND_TASK_SCHEDULE
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
parallelId | INT | Id of parallel region that this event belongs to.
priorTaskId | INT | Id of task that is being switched out.
priorTaskStatus | INT | OpenMP prior task status enum value.
nextTaskId | INT | Id of task that is being switched in.

### Cancel Event

Table name | OPENMP_EVENT_KIND_CANCEL
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
taskId | INT | Id of task that is being cancelled.

### Mutex Wait Event

Table name | OPENMP_EVENT_KIND_MUTEX_WAIT
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
kind | INT | OpenMP mutex kind enum value.
waitId | INT | Id indicating object being waited.
taskId | INT | Id of task that this event belongs to.

### Critical Section Event

Table name | OPENMP_EVENT_KIND_CRITICAL_SECTION
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
kind | INT | OpenMP critical section kind enum value.
waitId | INT | Id indicating object being held.

### Mutex Released Event

Table name | OPENMP_EVENT_KIND_MUTEX_RELEASED
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
kind | INT | OpenMP mutex kind enum value.
waitId | INT | Id indicating object being released.
taskId | INT | Id of task that this event belongs to.

### Lock Init / Lock Destroy Event

Table name | OPENMP_EVENT_KIND_LOCK_INIT / OPENMP_EVENT_KIND_LOCK_DESTROY
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
kind | INT | OpenMP mutex kind enum value.
waitId | INT | Id indicating object being created / destroyed.

### Workshare Event

Table name | OPENMP_EVENT_KIND_WORKSHARE
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
kind | INT | OpenMP workshare kind enum value. See https://www.openmp.org/spec-html/5.0/openmpsu185.html#x233-11890004.4.4.15.
parallelId | INT | Id of parallel region that this region belongs to.
taskId | INT | Id of task that this region belongs to.
count | INT | A measure of the quantity of work involved in the region. See https://www.openmp.org/spec-html/5.0/openmpsu187.html#x236-12830004.5.2.5.

### Dispatch Event

Table name | OPENMP_EVENT_KIND_DISPATCH
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
kind | INT | OpenMP dispatch kind enum value. See https://www.openmp.org/spec-html/5.0/openmpsu185.html#x233-11800004.4.4.12
parallelId | INT | Id of parallel region that this event belongs to.
taskId | INT | Id of task that this event belongs to.

### Flush Event

Table name | OPENMP_EVENT_KIND_FLUSH
--- | ---
Column Name | Column Type | Column Description
start | INT NOT NULL | Event start timestamp in nanoseconds.
end | INT NOT NULL | Event end timestamp in nanoseconds.
eventClass | INT NOT NULL | OpenMP event class enum value.
globalTid | INT | Serialized GlobalId.
correlationId | INT | Currently unused
nameId | INT NOT NULL | StringId of event name
eventKind | INT | OpenMP event kind enum value.
threadId | INT | Id of thread that this event belongs to. Note this is the internal thread sequence rather than the OS thread id.

### OpenMP event class values

- 78 - TRACE_PROCESS_EVENT_OPENMP
- 79 - TRACE_PROCESS_EVENT_OPENMP_START
- 80 - TRACE_PROCESS_EVENT_OPENMP_FINISH

### OpenMP event kind values

- 15 - OPENMP_EVENT_KIND_TASK_CREATE
- 16 - OPENMP_EVENT_KIND_TASK_SCHEDULE
- 17 - OPENMP_EVENT_KIND_CANCEL
- 20 - OPENMP_EVENT_KIND_MUTEX_RELEASED
- 21 - OPENMP_EVENT_KIND_LOCK_INIT
- 22 - OPENMP_EVENT_KIND_LOCK_DESTROY
- 25 - OPENMP_EVENT_KIND_DISPATCH
- 26 - OPENMP_EVENT_KIND_FLUSH
- 27 - OPENMP_EVENT_KIND_THREAD
- 28 - OPENMP_EVENT_KIND_PARALLEL
- 29 - OPENMP_EVENT_KIND_SYNC_REGION_WAIT
- 30 - OPENMP_EVENT_KIND_SYNC_REGION
- 31 - OPENMP_EVENT_KIND_TASK
- 32 - OPENMP_EVENT_KIND_MASTER
- 33 - OPENMP_EVENT_KIND_REDUCTION
- 34 - OPENMP_EVENT_KIND_MUTEX_WAIT
- 35 - OPENMP_EVENT_KIND_CRITICAL_SECTION
- 36 - OPENMP_EVENT_KIND_WORKSHARE

### OpenMP thread type values

- 1 - OpenMP Initial Thread
- 2 - OpenMP Worker Thread
- 3 - OpenMP Internal Thread
- 4 - Unknown

### OpenMP sync region kind values

- 1 - Barrier
- 2 - Implicit barrier
- 3 - Explicit barrier
- 4 - Implementation-dependent barrier
- 5 - Taskwait
- 6 - Taskgroup

### OpenMP task kind values

- 1 - Initial task
- 2 - Implicit task
- 3 - Explicit task

### OpenMP prior task status values

- 1 - Task completed
- 2 - Task yielded to another task
- 3 - Task was cancelled
- 7 - Task was switched out for other reasons

### OpenMP mutex kind values

- 1 - Waiting for lock
- 2 - Testing lock
- 3 - Waiting for nested lock
- 4 - Tesing nested lock
- 5 - Waitng for entering critical section region
- 6 - Waiting for entering atomic region
- 7 - Waiting for entering ordered region

### OpenMP critical section kind values

- 5 - Critical section region
- 6 - Atomic region
- 7 - Ordered region

### OpenMP workshare kind values

- 1 - Loop region
- 2 - Sections region
- 3 - Single region (executor)
- 4 - Single region (waiting)
- 5 - Workshare region
- 6 - Distrubute region
- 7 - Taskloop region

### OpenMP dispatch kind values

- 1 - Iteration
- 2 - Section

## Generic events

NVIDIA Nsight Systems is capable of collecting events for which the schema is known only at the run-time. Such events are referred to as generic and are exported distinctly from other event types. For every generic event there’s corresponding type schema and for every generic event type there’s source parameters description.

Due to how Nsight Systems handles generic event field values, their representation in encoded JSON data will always be of string type. If necessary, SQLite CAST function can be used to convert them.

Table name | GENERIC_EVENTS
--- | ---
Column Name | Column Type | Column Description
rawTimestamp | INT | Raw event timestamp recorded during profiling.
timestamp | INT | Event timestamp converted to the profiling session timeline.
typeId | INT REFERENCES GENERIC_EVENT_TYPES | Serialized GlobalId.
data | TEXT | JSON encoded event data.

Table name | GENERIC_EVENT_TYPES
--- | ---
Column Name | Column Type | Column Description
typeId | INT PRIMARY KEY | Serialized GlobalId.
sourceId | INT REFERENCES GENERIC_EVENT_SOURCES | Serialized GlobalId.
data | TEXT | JSON encoded generic event type description.

Table name | GENERIC_EVENT_SOURCES
--- | ---
Column Name | Column Type | Column Description
sourceId | INT PRIMARY KEY | Serialized GlobalId.
data | TEXT | JSON encoded generic event source description.

## Secondary tables

### String Ids

NVIDIA Nsight Systems stores strings from events in a global storage, each unique string has a corresponding integer id. The StringIds table is created from that storage.

Table name | StringIds
--- | ---
Column Name | Column Type | Column Description
id | INTEGER PRIMARY KEY | Integer key of a string.
value | TEXT NOT NULL | Text content of a string.

### Thread Names

Table name | ThreadNames
--- | ---
Column Name | Column Type | Column Description
nameId | INT NOT NULL | StringId of thread name.
globalTid | INT NOT NULL | Serialized GlobalId.

### Process streams

Table name | ProcessStreams
--- | ---
Column Name | Column Type | Column Description
globalPid | INT NOT NULL | Serialized GlobalId.
filenameId | INT NOT NULL | StringId of a file name.
contentId | INT NOT NULL | StringId of stream content.

### Enums

Protobuf enumeration types are exported as tables. Here’s an example structure for UnwindMethodType enumeration:

Table name | UnwindMethodType
--- | ---
Column Name | Column Type | Column Description
number | INTEGER PRIMARY KEY | Integer value of an enum constant.
name | TEXT NOT NULL | Text name of an enum constant.

## Extra types

### CUDA CopyKind enum

    enum CUDA_MEMCPY_KIND
    {
        CUDA_MEMCPY_KIND_UNKNOWN,
        CUDA_MEMCPY_KIND_HTOD,
        CUDA_MEMCPY_KIND_DTOH,
        CUDA_MEMCPY_KIND_HTOA,
        CUDA_MEMCPY_KIND_ATOH,
        CUDA_MEMCPY_KIND_ATOA,
        CUDA_MEMCPY_KIND_ATOD,
        CUDA_MEMCPY_KIND_DTOA,
        CUDA_MEMCPY_KIND_DTOD,
        CUDA_MEMCPY_KIND_HTOH,
        CUDA_MEMCPY_KIND_PTOP,
        CUDA_MEMCPY_KIND_UVM_HTOD,
        CUDA_MEMCPY_KIND_UVM_DTOH,
        CUDA_MEMCPY_KIND_UVM_DTOD,
    };

### Thread state enum

    enum ThreadState
    {
        Unknown,
        Running,
        Interruptible,
        Uninterruptible,
        Stopped,
        Terminated,
        // Estimated thread states.
        Unscheduled,
        Waiting,
        OSRuntime,
        // Windows thread states
        Initialized,
        Transition
    };