## ImportNvtxt

ImportNvtxt is an utility which allows to convert NVTXT file to Nsight Systems report file (*.qdrep) or to merge it with existing report file.

Note: NvtxtImport supports custom TimeBase values. Only these values are supported:

- Manual — timestamps are set using absolute values.
- Relative — timestamps are set using relative values with regards to report file which is being merged with nvtxt file.
- ClockMonotonicRaw — timestamps values in nvtxt file are considered to be gathered on the same target as the report file which is to be merged with nvtxt using `clock_gettime(CLOCK_MONOTONIC_RAW, ...)` call.
- CNTVCT — timestamps values in nvtxt file are considered to be gathered on the same target as the report file which is to be merged with nvtxt using CNTVCT values.

You can get usage info via help message:

>     Print help message:
>       -h [ --help ]

>     Show information about report file:
>       --cmd info -i [--input] arg

>     Create report file from existing nvtxt file:
>       --cmd create -n [--nvtxt] arg -o [--output] arg [-m [--mode] mode_name mode_args] [--target <Hw:Vm>] [--update_report_time]

>     Merge nvtxt file to existing report file:
>       --cmd merge -i [--input] arg -n [--nvtxt] arg -o [--output] arg [-m [--mode] mode_name mode_args] [--target <Hw:Vm>] [--update_report_time]

>     Modes description:
>       lerp - Insert with linear interpolation
>         --mode lerp --ns_a arg --ns_b arg [--nvtxt_a arg --nvtxt_b arg]
>       lin - insert with linear equation
>         --mode lin  --ns_a arg --freq arg [--nvtxt_a arg]

>     Modes' parameters:
>       ns_a    - a nanoseconds value
>       ns_b    - a nanoseconds value (greater than ns_a)
>       nvtxt_a - an nvtxt file's time unit value corresponding to ns_a nanoseconds
>       nvtxt_b - an nvtxt file's time unit value corresponding to ns_b nanoseconds
>       freq    - the nvtxt file's timer frequency

>     --target <Hw:Vm> - specify target id, e.g. --target 0:1

>     --update_report_time - prolong report's profiling session time while
>         merging if needed. Without this option all events outside the
>         profiling session time window will be skipped during merging.

### Commands

#### Info

To find out report's start and end time use info command.

Usage:

>     ImportNvtxt --cmd info -i [--input] arg

Example:

>     ImportNvtxt info Report.qdrep
>     Analysis start (ns) 83501026500000
>     Analysis end (ns)   83506375000000

#### Create

You can create a report file using existing NVTXT with create command. Usage:

>     ImportNvtxt --cmd create -n [--nvtxt] arg -o [--output] arg [-m [--mode] mode_name mode_args]

Available modes are:

- lerp — insert with linear interpolation.
- lin — insert with linear equation.

Usage for lerp mode is:

>     --mode lerp --ns_a arg --ns_b arg [--nvtxt_a arg --nvtxt_b arg]

with:

- `ns_a` — a nanoseconds value.
- `ns_b` — a nanoseconds value (greater than `ns_a`).
- `nvtxt_a` — an nvtxt file's time unit value corresponding to `ns_a` nanoseconds.
- `nvtxt_b` — an nvtxt file's time unit value corresponding to `ns_b` nanoseconds.

If `nvtxt_a` and `nvtxt_b` are not specified, they are repectively set to nvtxt file's minimum and maximum time value.

Usage for lin mode is:

>     --mode lin --ns_a arg --freq arg [--nvtxt_a arg]

with:

- `ns_a` — a nanoseconds value.
- `freq` — the nvtxt file's timer frequency.
- `nvtxt_a` — an nvtxt file's time unit value corresponding to `ns_a` nanoseconds.

If `nvtxt_a` is not specified, it is set to nvtxt file's minimum time value.

Examples:

>     ImportNvtxt --cmd create -n Sample.nvtxt -o Report.qdrep

The output will be a new generated report file which can be opened and viewed by the Nsight Systems.

Available modes:

#### Merge

To merge NVTXT file with an existing report file use merge command.

Usage:

>     ImportNvtxt --cmd merge -i [--input] arg -n [--nvtxt] arg -o [--output] arg [-m [--mode] mode_name mode_args]

Available modes are:

- lerp — insert with linear interpolation.
- lin — insert with linear equation.

Usage for lerp mode is:

>     --mode lerp --ns_a arg --ns_b arg [--nvtxt_a arg --nvtxt_b arg]

with:

- `ns_a` — a nanoseconds value.
- `ns_b` — a nanoseconds value (greater than `ns_a`).
- `nvtxt_a` — an nvtxt file's time unit value corresponding to `ns_a` nanoseconds.
- `nvtxt_b` — an nvtxt file's time unit value corresponding to `ns_b` nanoseconds.

If `nvtxt_a` and `nvtxt_b` are not specified, they are repectively set to nvtxt file's minimum and maximum time value.

Usage for lin mode is:

>     --mode lin  --ns_a arg --freq arg [--nvtxt_a arg]

with:

- `ns_a` — a nanoseconds value.
- `freq` — the nvtxt file's timer frequency.
- `nvtxt_a` — an nvtxt file's time unit value corresponding to `ns_a` nanoseconds.

If `nvtxt_a` is not specified, it is set to nvtxt file's minimum time value.

Time values in `<filename.nvtxt>` are assumed to be nanoseconds if no mode specified.

Example:

>     ImportNvtxt --cmd merge -i Report.qdrep -n Sample.nvtxt -o NewReport.qdrep

Copyright (c) 2012-2020, NVIDIA Corporation. All rights reserved.