tf2.11 tf.profiler.experimental doesn't generate trace.json.gz. Possible to have a python script to get the json.gz from xplane.pb?
loop @aice-support @sushreebarsa 
any update for this question? I have replicated the reported behaviour. With Tf 2.10v I found many files along with xplane.pb being built but with TF2.12 and tf-nightly there is only one file i.e. xplane.pb. I have attached minimal code snippet for replicating the behaviour in attached [gist](https://colab.sandbox.google.com/gist/SuryanarayanaY/dc945ea54171d35a0bd6a65a0d2e6b2b/60060.ipynb).

**With TF 2.10:**

<img width="1512" alt="Screenshot 2023-04-12 at 2 53 17 PM" src="https://user-images.githubusercontent.com/116063290/231417640-4c1a9ac2-a481-4b5b-96ed-18fd877175ea.png">


**With TF2.12:**

<img width="1512" alt="Screenshot 2023-04-12 at 2 50 09 PM" src="https://user-images.githubusercontent.com/116063290/231417430-2188e423-965d-4b01-b751-087bda35f86c.png">

@louie-tsai , I need to check the reasons for this difference in behaviour and will update you if ay workaround. Thanks @SuryanarayanaY 
thanks. It also works for me to generate trace.json file from xplane.pb file from a tool/script. Hi @louie-tsai ,

Have you used any tool outside Tensorflow for this? Please confirm and also if issue resolved please feel free to close the issue. Thanks! @SuryanarayanaY 
Oh. I haven't had any solution by using other tool.
If you have a tool to convert it, that option would also work for me.
 Hi @louie-tsai ,

The reason for this behavior after 2.10 version because of the changes made here in the commit https://github.com/tensorflow/tensorflow/commit/52992fc29f00fc743e07e16067f6418af6c489ff.

The detailed discussion can be found here https://github.com/tensorflow/tensorflow/issues/58738.
 @sachinprasadhs 
is there a way to get the json.gz from xplane.pb?
json.gz file is helpful for our debugging. We have had some analysis tools depending on it already.
thanks @cliveverghese, Could you please take a look into the above request. Thanks! You could use pywrap_profiler functions defined in https://github.com/tensorflow/tensorflow/blob/f62622072d3b6de1790861ba749a1bfa043bd1dd/tensorflow/python/profiler/internal/profiler_wrapper.cc to extract the trace.json. 

References to how this can be invoked can be found here
https://github.com/tensorflow/profiler/blob/85dcfd10656d623330b11c3bbb8afed6418ec533/plugin/tensorboard_plugin_profile/convert/raw_to_tool_data.py

This would look like 
```
pywrap_profiler.xspace_to_tools_data(xspace_file_path, "trace_viewer")
``` @cliveverghese's comment got me to finally get the `.json` out of this annoying file format. I made this Python script (with a patch from @louie-tsai):

```py
import argparse

# Create argument parser
parser = argparse.ArgumentParser(description="Convert raw file to tool data")
parser.add_argument("input_file", help="Input file path")
parser.add_argument("output_file", help="Output JSON file path")

# Parse the arguments
args = parser.parse_args()

# Process the input file
print("\033[32mImport TensorFlow...\033[0m")
import tensorboard_plugin_profile.convert.raw_to_tool_data as rttd
input_file = args.input_file
print("\033[32mXSpace to Tool Data...\033[0m")
tv = rttd.xspace_to_tool_data([input_file], "trace_viewer^", {'tqx': ''})

if isinstance(tv, tuple):
    tv = tv[0]

# Write the processed data to the output file
output_file = args.output_file
print("\033[32mWriting file...\033[0m")
with open(output_file, "w") as f:
    f.write(tv)

print("\033[32mDone!\033[0m")

``` thanks a lot! It works for me.
We will start using this API for our analysis tool. Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60060">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/60060">No</a>
 output of xspace_to_tool_data is tuple data format for my case, so I need to only get first item of the tuple data. > output of xspace_to_tool_data is tuple data format for my case, so I need to only get first item of the tuple data.

I now had this problem too. I put an if in the code to support multiple versions of TensorFlow.
I also added colors for fun. I updated the code in my original answer.
<details><summary>Click to expand!</summary> 
 
 ### Issue Type

Bug

### Have you reproduced the bug with TF nightly?

Yes

### Source

binary

### Tensorflow Version

tf2.11

### Custom Code

Yes

### OS Platform and Distribution

Linux Ubuntu 22.04

### Mobile device

_No response_

### Python version

3.9

### Bazel version

_No response_

### GCC/Compiler version

_No response_

### CUDA/cuDNN version

_No response_

### GPU model and memory

_No response_

### Current Behaviour?

```shell
In tf2.10, when use the tf.profiler.experimental.start(logdir) and tf.profiler.experimental.stop(). It will generate many files as bellow in logdir folder.
.
├── events.out.tfevents.XXXX.profile-empty
└── plugins
    └── profile
        └── 2022_11_29_08_25_43
            ├── XXXX.input_pipeline.pb
            ├── XXXX.kernel_stats.pb
            ├── XXXX.memory_profile.json.gz
            ├── XXXX.overview_page.pb
            ├── XXXX.tensorflow_stats.pb
            ├── XXXX.trace.json
            └── XXXX.xplane.pb

But in tf2.11, it only generate these files.
.
├── events.out.tfevents.XXXX.profile-empty
└── plugins
    └── profile
        ├── 2022_11_29_08_32_10
        │   └── XXXX.xplane.pb

Possible to derive json.gz file from xplane.pb with some python scripts?
```


### Standalone code to reproduce the issue

```shell
NA
```


### Relevant log output

_No response_</details>