/**
 * Copyright 2022-2025 NVIDIA Corporation.  All rights reserved.
 *
 * Please refer to the NVIDIA end user license agreement (EULA) associated
 * with this source code for terms and conditions that govern your use of
 * this software. Any use, reproduction, disclosure, or distribution of
 * this software and related documentation outside the terms of the EULA
 * is strictly prohibited.
 *
 * This file is generated
 */

////////////////////////////////////////////////////////////////////////////////

#ifndef HELPER_CUPTI_ACTIVITY_USER_DEFINED_RECORDS_H_
#define HELPER_CUPTI_ACTIVITY_USER_DEFINED_RECORDS_H_

#pragma once

#include <iostream>
#include <iomanip>
#include <cstdint>

// CUPTI headers
#include <cupti_activity.h>
#include <helper_cupti_activity_enums.h>

static void
PrintUserDefinedActivity(
    CUpti_Activity *pRecord,
    CUpti_ActivityRecordLayout layout,
    std::ostream& out = std::cout)
{
    CUpti_ActivityKind activityKind = pRecord->kind;

    switch (activityKind)
    {
        
        case CUPTI_ACTIVITY_KIND_MEMCPY:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMemcpyFieldIds)entry.fieldId)
                {
                    case MEMCPY_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_COPY_KIND:
                        out << "copyKind: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_SRC_KIND:
                        out << "srcKind: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_DST_KIND:
                        out << "dstKind: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_FLAGS:
                        out << "flags: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_BYTES:
                        out << "bytes: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_GRAPH_NODE_ID:
                        out << "graphNodeId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_CHANNEL_ID:
                        out << "channelID: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_IS_DEVICE_LAUNCHED:
                        out << "isDeviceLaunched: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY_FIELD_COPY_COUNT:
                        out << "copyCount: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MEMSET:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMemsetFieldIds)entry.fieldId)
                {
                    case MEMSET_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEMSET_FIELD_VALUE:
                        out << "value: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_BYTES:
                        out << "bytes: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_FLAGS:
                        out << "flags: " << *(const uint16_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_MEMORY_KIND:
                        out << "memoryKind: " << *(const uint16_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_GRAPH_NODE_ID:
                        out << "graphNodeId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_CHANNEL_ID:
                        out << "channelID: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMSET_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    case MEMSET_FIELD_IS_DEVICE_LAUNCHED:
                        out << "isDeviceLaunched: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_KERNEL:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityKernelFieldIds)entry.fieldId)
                {
                    case KERNEL_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_CACHE_CONFIG_REQUESTED:
                        out << "cacheConfigRequested: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_CACHE_CONFIG_EXECUTED:
                        out << "cacheConfigExecuted: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_SHARED_MEMORY_CONFIG:
                        out << "sharedMemoryConfig: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_REGISTERS_PER_THREAD:
                        out << "registersPerThread: " << *(const uint16_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_PARTITIONED_GLOBAL_CACHE_REQUESTED:
                        out << "partitionedGlobalCacheRequested: " << GetActivityPartitionedGlobalCacheConfigString(*(const CUpti_ActivityPartitionedGlobalCacheConfig *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_PARTITIONED_GLOBAL_CACHE_EXECUTED:
                        out << "partitionedGlobalCacheExecuted: " << GetActivityPartitionedGlobalCacheConfigString(*(const CUpti_ActivityPartitionedGlobalCacheConfig *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_COMPLETED:
                        out << "completed: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_X:
                        out << "gridX: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_Y:
                        out << "gridY: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_Z:
                        out << "gridZ: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_BLOCK_X:
                        out << "blockX: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_BLOCK_Y:
                        out << "blockY: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_BLOCK_Z:
                        out << "blockZ: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_STATIC_SHARED_MEMORY:
                        out << "staticSharedMemory: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_DYNAMIC_SHARED_MEMORY:
                        out << "dynamicSharedMemory: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_LOCAL_MEMORY_PER_THREAD:
                        out << "localMemoryPerThread: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_ID:
                        out << "gridId: " << *(const int64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_NAME:
                        out << "name: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    case KERNEL_FIELD_QUEUED:
                        out << "queued: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_SUBMITTED:
                        out << "submitted: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_LAUNCH_TYPE:
                        out << "launchType: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_IS_SHARED_MEMORY_CARVEOUT_REQUESTED:
                        out << "isSharedMemoryCarveoutRequested: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_SHARED_MEMORY_CARVEOUT_REQUESTED:
                        out << "sharedMemoryCarveoutRequested: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_SHARED_MEMORY_EXECUTED:
                        out << "sharedMemoryExecuted: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRAPH_NODE_ID:
                        out << "graphNodeId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_SHMEM_LIMIT_CONFIG:
                        out << "shmemLimitConfig: " << GetFuncShmemLimitConfigString(*(const CUpti_FuncShmemLimitConfig *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_ACCESS_POLICY_WINDOW:
                        out << "pAccessPolicyWindow: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case KERNEL_FIELD_CHANNEL_ID:
                        out << "channelID: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_X:
                        out << "clusterX: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_Y:
                        out << "clusterY: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_Z:
                        out << "clusterZ: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_SCHEDULING_POLICY:
                        out << "clusterSchedulingPolicy: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_LOCAL_MEMORY_TOTAL:
                        out << "localMemoryTotal: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_MAX_POTENTIAL_CLUSTER_SIZE:
                        out << "maxPotentialClusterSize: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_MAX_ACTIVE_CLUSTERS:
                        out << "maxActiveClusters: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_IS_DEVICE_LAUNCHED:
                        out << "isDeviceLaunched: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_LAUNCH_PRIORITY:
                        out << "launchPriority: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_DRIVER:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityApiFieldIds)entry.fieldId)
                {
                    case API_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case API_FIELD_CBID:
                    {
                        const char *name = NULL;
                        cuptiGetCallbackName(CUPTI_CB_DOMAIN_DRIVER_API, *(const uint32_t *)pEntryOffset, &name);
                        out << "cbid: " << (name ? name : "<null>") << ", ";
                        break;
                    }
                    case API_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_RETURN_VALUE:
                        out << "returnValue: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_DEVICE:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityDeviceFieldIds)entry.fieldId)
                {
                    case DEVICE_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case DEVICE_FIELD_FLAGS:
                        out << "flags: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case DEVICE_FIELD_GLOBAL_MEMORY_BANDWIDTH:
                        out << "globalMemoryBandwidth: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_GLOBAL_MEMORY_SIZE:
                        out << "globalMemorySize: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_CONSTANT_MEMORY_SIZE:
                        out << "constantMemorySize: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_L2_CACHE_SIZE:
                        out << "l2CacheSize: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_NUM_THREADS_PER_WARP:
                        out << "numThreadsPerWarp: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_CORE_CLOCK_RATE:
                        out << "coreClockRate: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_NUM_MEMCPY_ENGINES:
                        out << "numMemcpyEngines: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_NUM_MULTIPROCESSORS:
                        out << "numMultiprocessors: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_IPC:
                        out << "maxIPC: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_WARPS_PER_MULTIPROCESSOR:
                        out << "maxWarpsPerMultiprocessor: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_BLOCKS_PER_MULTIPROCESSOR:
                        out << "maxBlocksPerMultiprocessor: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR:
                        out << "maxSharedMemoryPerMultiprocessor: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_REGISTERS_PER_MULTIPROCESSOR:
                        out << "maxRegistersPerMultiprocessor: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_REGISTERS_PER_BLOCK:
                        out << "maxRegistersPerBlock: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_SHARED_MEMORY_PER_BLOCK:
                        out << "maxSharedMemoryPerBlock: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_THREADS_PER_BLOCK:
                        out << "maxThreadsPerBlock: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_BLOCK_DIM_X:
                        out << "maxBlockDimX: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_BLOCK_DIM_Y:
                        out << "maxBlockDimY: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_BLOCK_DIM_Z:
                        out << "maxBlockDimZ: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_GRID_DIM_X:
                        out << "maxGridDimX: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_GRID_DIM_Y:
                        out << "maxGridDimY: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MAX_GRID_DIM_Z:
                        out << "maxGridDimZ: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_COMPUTE_CAPABILITY_MAJOR:
                        out << "computeCapabilityMajor: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_COMPUTE_CAPABILITY_MINOR:
                        out << "computeCapabilityMinor: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_ID:
                        out << "id: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_ECC_ENABLED:
                        out << "eccEnabled: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_UUID:
                        out << "uuid: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case DEVICE_FIELD_NAME:
                        out << "name: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    case DEVICE_FIELD_IS_CUDA_VISIBLE:
                        out << "isCudaVisible: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case DEVICE_FIELD_IS_MIG_ENABLED:
                        out << "isMigEnabled: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case DEVICE_FIELD_GPU_INSTANCE_ID:
                        out << "gpuInstanceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_COMPUTE_INSTANCE_ID:
                        out << "computeInstanceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_MIG_UUID:
                        out << "migUuid: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case DEVICE_FIELD_IS_NUMA_NODE:
                        out << "isNumaNode: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_NUMA_ID:
                        out << "numaId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_FIELD_NUM_TPCS:
                        out << "numTpcs: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_CONTEXT:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityContextFieldIds)entry.fieldId)
                {
                    case CONTEXT_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case CONTEXT_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONTEXT_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONTEXT_FIELD_COMPUTE_API_KIND:
                        out << "computeApiKind: " << GetActivityComputeApiKindString(*(const CUpti_ActivityComputeApiKind *)(pEntryOffset)) << ", ";
                        break;
                    case CONTEXT_FIELD_NULL_STREAM_ID:
                        out << "nullStreamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONTEXT_FIELD_PARENT_CONTEXT_ID:
                        out << "parentContextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONTEXT_FIELD_IS_GREEN_CONTEXT:
                        out << "isGreenContext: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case CONTEXT_FIELD_NUM_MULTIPROCESSORS:
                        out << "numMultiprocessors: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONTEXT_FIELD_CIG_MODE:
                        out << "cigMode: " << GetContextCigModeString(*(const CUpti_ContextCigMode *)(pEntryOffset)) << ", ";
                        break;
                    case CONTEXT_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_NAME:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityNameFieldIds)entry.fieldId)
                {
                    case NAME_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case NAME_FIELD_OBJECT_KIND:
                        out << "objectKind: " << GetActivityObjectKindString(*(const CUpti_ActivityObjectKind *)(pEntryOffset)) << ", ";
                        break;
                    case NAME_FIELD_OBJECT_ID:
                        out << "objectId: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case NAME_FIELD_NAME:
                        out << "name: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MARKER:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMarkerFieldIds)entry.fieldId)
                {
                    case MARKER_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MARKER_FIELD_FLAGS:
                        out << "flags: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case MARKER_FIELD_TIMESTAMP:
                        out << "timestamp: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_FIELD_ID:
                        out << "id: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_FIELD_NAME:
                        out << "name: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    case MARKER_FIELD_DOMAIN:
                        out << "domain: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MARKER_DATA:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMarkerDataFieldIds)entry.fieldId)
                {
                    case MARKER_DATA_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MARKER_DATA_FIELD_FLAGS:
                        out << "flags: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case MARKER_DATA_FIELD_ID:
                        out << "id: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_DATA_FIELD_PAYLOAD_KIND:
                        out << "payloadKind: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case MARKER_DATA_FIELD_PAYLOAD:
                        out << "payload: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case MARKER_DATA_FIELD_COLOR:
                        out << "color: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_DATA_FIELD_CATEGORY:
                        out << "category: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MARKER_DATA_FIELD_CUPTI_DOMAIN_ID:
                        out << "cuptiDomainId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_OVERHEAD:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityOverheadFieldIds)entry.fieldId)
                {
                    case OVERHEAD_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case OVERHEAD_FIELD_OVERHEAD_KIND:
                        out << "overheadKind: " << GetActivityOverheadKindString(*(const CUpti_ActivityOverheadKind *)(pEntryOffset)) << ", ";
                        break;
                    case OVERHEAD_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case OVERHEAD_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case OVERHEAD_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case OVERHEAD_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case OVERHEAD_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case OVERHEAD_FIELD_OVERHEAD_DATA:
                        out << "overheadData: " << "<unknown_field_data_type>" << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MEMCPY2:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMemcpy2FieldIds)entry.fieldId)
                {
                    case MEMCPY2_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY2_FIELD_COPY_KIND:
                        out << "copyKind: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY2_FIELD_SRC_KIND:
                        out << "srcKind: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY2_FIELD_DST_KIND:
                        out << "dstKind: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY2_FIELD_FLAGS:
                        out << "flags: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case MEMCPY2_FIELD_BYTES:
                        out << "bytes: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_SRC_DEVICE_ID:
                        out << "srcDeviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_SRC_CONTEXT_ID:
                        out << "srcContextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_DST_DEVICE_ID:
                        out << "dstDeviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_DST_CONTEXT_ID:
                        out << "dstContextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_GRAPH_NODE_ID:
                        out << "graphNodeId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_CHANNEL_ID:
                        out << "channelID: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMCPY2_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_UNIFIED_MEMORY_COUNTER:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityUvmCounterFieldIds)entry.fieldId)
                {
                    case UVM_COUNTER_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_COUNTER_KIND:
                        out << "counterKind: " << GetActivityUnifiedMemoryCounterKindString(*(const CUpti_ActivityUnifiedMemoryCounterKind *)(pEntryOffset)) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_VALUE:
                        out << "value: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_ADDRESS:
                        out << "address: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_SRC_ID:
                        out << "srcId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_DST_ID:
                        out << "dstId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_FLAGS:
                        out << "flags: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case UVM_COUNTER_FIELD_PROCESSORS:
                        out << "processors: " << "<unknown_field_data_type>" << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_CUDA_EVENT:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityCudaEventFieldIds)entry.fieldId)
                {
                    case CUDA_EVENT_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_EVENT_ID:
                        out << "eventId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_DEVICE_TIMESTAMP:
                        out << "deviceTimestamp: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case CUDA_EVENT_FIELD_CUDA_EVENT_SYNC_ID:
                        out << "cudaEventSyncId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_STREAM:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityStreamFieldIds)entry.fieldId)
                {
                    case STREAM_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case STREAM_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case STREAM_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case STREAM_FIELD_PRIORITY:
                        out << "priority: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case STREAM_FIELD_FLAG:
                        out << "flag: " << GetActivityStreamFlagString(*(const CUpti_ActivityStreamFlag *)(pEntryOffset)) << ", ";
                        break;
                    case STREAM_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_SYNCHRONIZATION:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivitySynchronizationFieldIds)entry.fieldId)
                {
                    case SYNCHRONIZATION_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_TYPE:
                        out << "type: " << GetActivitySynchronizationTypeString(*(const CUpti_ActivitySynchronizationType *)(pEntryOffset)) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_CUDA_EVENT_ID:
                        out << "cudaEventId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_CUDA_EVENT_SYNC_ID:
                        out << "cudaEventSyncId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case SYNCHRONIZATION_FIELD_RETURN_VALUE:
                        out << "returnValue: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_EXTERNAL_CORRELATION:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityExternalCorrelationFieldIds)entry.fieldId)
                {
                    case EXTERNAL_CORRELATION_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case EXTERNAL_CORRELATION_FIELD_EXTERNAL_KIND:
                        out << "externalKind: " << GetExternalCorrelationKindString(*(const CUpti_ExternalCorrelationKind *)(pEntryOffset)) << ", ";
                        break;
                    case EXTERNAL_CORRELATION_FIELD_EXTERNAL_ID:
                        out << "externalId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case EXTERNAL_CORRELATION_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MEMORY2:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMemoryFieldIds)entry.fieldId)
                {
                    case MEMORY_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_FIELD_OPERATION_TYPE:
                        out << "memoryOperationType: " << GetActivityMemoryOperationTypeString(*(const CUpti_ActivityMemoryOperationType *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_FIELD_MEMORY_KIND:
                        out << "memoryKind: " << GetActivityMemoryKindString(*(const CUpti_ActivityMemoryKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_ADDRESS:
                        out << "address: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_BYTES:
                        out << "bytes: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_TIMESTAMP:
                        out << "timestamp: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_IS_ASYNC:
                        out << "isAsync: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_POOL_TYPE:
                        out << "memoryPoolType: " << GetActivityMemoryPoolTypeString(*(const CUpti_ActivityMemoryPoolType *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_FIELD_POOL_ADDRESS:
                        out << "memoryPoolAddress: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_POOL_RELEASE_THRESHOLD:
                        out << "memoryPoolReleaseThreshold: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_POOL_SIZE:
                        out << "memoryPoolSize: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_POOL_PROCESS_ID:
                        out << "memoryPoolProcessId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_POOL_UTILIZED_SIZE:
                        out << "memoryPoolUtilizedSize: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_FIELD_SOURCE:
                        out << "source: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MEMORY_POOL:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMemoryPoolFieldIds)entry.fieldId)
                {
                    case MEMORY_POOL_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_OPERATION_TYPE:
                        out << "memoryPoolOperationType: " << GetActivityMemoryPoolOperationTypeString(*(const CUpti_ActivityMemoryPoolOperationType *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_POOL_TYPE:
                        out << "memoryPoolType: " << GetActivityMemoryPoolTypeString(*(const CUpti_ActivityMemoryPoolType *)(pEntryOffset)) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_MIN_BYTES_TO_KEEP:
                        out << "minBytesToKeep: " << *(const size_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_ADDRESS:
                        out << "address: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_SIZE:
                        out << "size: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_RELEASE_THRESHOLD:
                        out << "releaseThreshold: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_TIMESTAMP:
                        out << "timestamp: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_UTILIZED_SIZE:
                        out << "utilizedSize: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEMORY_POOL_FIELD_IS_MANAGED_POOL:
                        out << "isManagedPool: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_GRAPH_TRACE:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityGraphTraceFieldIds)entry.fieldId)
                {
                    case GRAPH_TRACE_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_END_DEVICE_ID:
                        out << "endDeviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_TRACE_FIELD_END_CONTEXT_ID:
                        out << "endContextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_JIT:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityJitFieldIds)entry.fieldId)
                {
                    case JIT_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case JIT_FIELD_ENTRY_TYPE:
                        out << "jitEntryType: " << GetActivityJitEntryTypeString(*(const CUpti_ActivityJitEntryType *)(pEntryOffset)) << ", ";
                        break;
                    case JIT_FIELD_OPERATION_TYPE:
                        out << "jitOperationType: " << GetActivityJitOperationTypeString(*(const CUpti_ActivityJitOperationType *)(pEntryOffset)) << ", ";
                        break;
                    case JIT_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_OPERATION_CORRELATION_ID:
                        out << "jitOperationCorrelationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_CACHE_SIZE:
                        out << "cacheSize: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_CACHE_PATH:
                        out << "cachePath: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    case JIT_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case JIT_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_DEVICE_GRAPH_TRACE:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityDeviceGraphTraceFieldIds)entry.fieldId)
                {
                    case DEVICE_GRAPH_TRACE_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_LAUNCHER_GRAPH_ID:
                        out << "launcherGraphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_DEVICE_LAUNCH_MODE:
                        out << "deviceLaunchMode: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case DEVICE_GRAPH_TRACE_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_MEM_DECOMPRESS:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityMemDecompressFieldIds)entry.fieldId)
                {
                    case MEM_DECOMPRESS_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_CHANNEL_ID:
                        out << "channelID: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_NUMBER_OF_OPERATIONS:
                        out << "numberOfOperations: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_SOURCE_BYTES:
                        out << "sourceBytes: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case MEM_DECOMPRESS_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_CONFIDENTIAL_COMPUTE_ROTATION:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityConfidentialComputeRotationFieldIds)entry.fieldId)
                {
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_EVENT_TYPE:
                        out << "eventType: " << GetConfidentialComputeRotationEventTypeString(*(const CUpti_ConfidentialComputeRotationEventType *)(pEntryOffset)) << ", ";
                        break;
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_CHANNEL_ID:
                        out << "channelId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    case CONFIDENTIAL_COMPUTE_ROTATION_FIELD_TIMESTAMP:
                        out << "timestamp: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_GRAPH_HOST_NODE:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityGraphHostNodeFieldIds)entry.fieldId)
                {
                    case GRAPH_HOST_NODE_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_GRAPH_NODE_ID:
                        out << "graphNodeId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GRAPH_HOST_NODE_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_COMPUTE_ENGINE_CTX_SWITCH:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityComputeEngineCtxSwitchFieldIds)entry.fieldId)
                {
                    case COMPUTE_ENGINE_CTX_SWITCH_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case COMPUTE_ENGINE_CTX_SWITCH_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case COMPUTE_ENGINE_CTX_SWITCH_FIELD_TIMESTAMP:
                        out << "timestamp: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case COMPUTE_ENGINE_CTX_SWITCH_FIELD_OPERATION_TYPE:
                        out << "operationType: " << GetComputeEngineCtxSwitchOperationTypeString(*(const CUpti_ComputeEngineCtxSwitchOperationType *)(pEntryOffset)) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_HOST_LAUNCH:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityHostLaunchFieldIds)entry.fieldId)
                {
                    case HOST_LAUNCH_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case HOST_LAUNCH_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_GREEN_CONTEXT:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityGreenContextFieldIds)entry.fieldId)
                {
                    case GREEN_CONTEXT_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_PARENT_CONTEXT_ID:
                        out << "parentContextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_NUM_MULTIPROCESSORS:
                        out << "numMultiprocessors: " << *(const uint16_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_NUM_TPCS:
                        out << "numTpcs: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_LOGICAL_TPC_MASK_SIZE:
                        out << "logicalTpcMaskSize: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_LOGICAL_TPC_MASK:
                        out << "logicalTpcMask: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_WORKQUEUE_RESOURCE_ID:
                        out << "workqueueResourceId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_WORKQUEUE_CONCURRENCY_LIMIT:
                        out << "workqueueConcurrencyLimit: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case GREEN_CONTEXT_FIELD_WORKQUEUE_SHARING_SCOPE:
                        out << "workqueueSharingScope: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityKernelFieldIds)entry.fieldId)
                {
                    case KERNEL_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_CACHE_CONFIG_REQUESTED:
                        out << "cacheConfigRequested: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_CACHE_CONFIG_EXECUTED:
                        out << "cacheConfigExecuted: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_SHARED_MEMORY_CONFIG:
                        out << "sharedMemoryConfig: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_REGISTERS_PER_THREAD:
                        out << "registersPerThread: " << *(const uint16_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_PARTITIONED_GLOBAL_CACHE_REQUESTED:
                        out << "partitionedGlobalCacheRequested: " << GetActivityPartitionedGlobalCacheConfigString(*(const CUpti_ActivityPartitionedGlobalCacheConfig *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_PARTITIONED_GLOBAL_CACHE_EXECUTED:
                        out << "partitionedGlobalCacheExecuted: " << GetActivityPartitionedGlobalCacheConfigString(*(const CUpti_ActivityPartitionedGlobalCacheConfig *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_COMPLETED:
                        out << "completed: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_DEVICE_ID:
                        out << "deviceId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CONTEXT_ID:
                        out << "contextId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_STREAM_ID:
                        out << "streamId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_X:
                        out << "gridX: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_Y:
                        out << "gridY: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_Z:
                        out << "gridZ: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_BLOCK_X:
                        out << "blockX: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_BLOCK_Y:
                        out << "blockY: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_BLOCK_Z:
                        out << "blockZ: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_STATIC_SHARED_MEMORY:
                        out << "staticSharedMemory: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_DYNAMIC_SHARED_MEMORY:
                        out << "dynamicSharedMemory: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_LOCAL_MEMORY_PER_THREAD:
                        out << "localMemoryPerThread: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRID_ID:
                        out << "gridId: " << *(const int64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_NAME:
                        out << "name: " << (*(const char **)(pEntryOffset) ? *(const char **)(pEntryOffset) : "(null)") << ", ";
                        break;
                    case KERNEL_FIELD_QUEUED:
                        out << "queued: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_SUBMITTED:
                        out << "submitted: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_LAUNCH_TYPE:
                        out << "launchType: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_IS_SHARED_MEMORY_CARVEOUT_REQUESTED:
                        out << "isSharedMemoryCarveoutRequested: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_SHARED_MEMORY_CARVEOUT_REQUESTED:
                        out << "sharedMemoryCarveoutRequested: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_SHARED_MEMORY_EXECUTED:
                        out << "sharedMemoryExecuted: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_GRAPH_NODE_ID:
                        out << "graphNodeId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_SHMEM_LIMIT_CONFIG:
                        out << "shmemLimitConfig: " << GetFuncShmemLimitConfigString(*(const CUpti_FuncShmemLimitConfig *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_GRAPH_ID:
                        out << "graphId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_ACCESS_POLICY_WINDOW:
                        out << "pAccessPolicyWindow: " << "<unknown_field_data_type>" << ", ";
                        break;
                    case KERNEL_FIELD_CHANNEL_ID:
                        out << "channelID: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CHANNEL_TYPE:
                        out << "channelType: " << GetChannelTypeString(*(const CUpti_ChannelType *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_X:
                        out << "clusterX: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_Y:
                        out << "clusterY: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_Z:
                        out << "clusterZ: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_CLUSTER_SCHEDULING_POLICY:
                        out << "clusterSchedulingPolicy: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_LOCAL_MEMORY_TOTAL:
                        out << "localMemoryTotal: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_MAX_POTENTIAL_CLUSTER_SIZE:
                        out << "maxPotentialClusterSize: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_MAX_ACTIVE_CLUSTERS:
                        out << "maxActiveClusters: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case KERNEL_FIELD_IS_DEVICE_LAUNCHED:
                        out << "isDeviceLaunched: " << static_cast<int>(*(const uint8_t *)(pEntryOffset)) << ", ";
                        break;
                    case KERNEL_FIELD_LAUNCH_PRIORITY:
                        out << "launchPriority: " << *(const int32_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_RUNTIME:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityApiFieldIds)entry.fieldId)
                {
                    case API_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case API_FIELD_CBID:
                    {
                        const char *name = NULL;
                        cuptiGetCallbackName(CUPTI_CB_DOMAIN_RUNTIME_API, *(const uint32_t *)pEntryOffset, &name);
                        out << "cbid: " << (name ? name : "<null>") << ", ";
                        break;
                    }
                    case API_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_RETURN_VALUE:
                        out << "returnValue: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        case CUPTI_ACTIVITY_KIND_INTERNAL_LAUNCH_API:
        {
            out << std::endl;
            for (size_t i = 0; i < layout.numFields; i++)
            {
                CUpti_ActivityFieldLayoutEntry entry = layout.pEntries[i];
                uint8_t *pEntryOffset = (uint8_t *)pRecord + entry.offset;
                switch ((CUpti_ActivityApiFieldIds)entry.fieldId)
                {
                    case API_FIELD_KIND:
                        out << "kind: " << GetActivityKindString(*(const CUpti_ActivityKind *)(pEntryOffset)) << ", ";
                        break;
                    case API_FIELD_START:
                        out << "start: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_END:
                        out << "end: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_PROCESS_ID:
                        out << "processId: " << *(const uint32_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_THREAD_ID:
                        out << "threadId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_CORRELATION_ID:
                        out << "correlationId: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    case API_FIELD_RETURN_VALUE:
                        out << "returnValue: " << *(const uint64_t *)(pEntryOffset) << ", ";
                        break;
                    default:
                        out << "<unknown_field_id>";
                        break;
                }
            }
            out << "\n" << std::endl;
            break;
        }
        
        default:
            out << "<unknown>" << std::endl;
            break;
    }
}

#endif // HELPER_CUPTI_ACTIVITY_USER_DEFINED_RECORDS_H_