How to parse .trace file to get CPU performance usage data for iOS apps

I am working on a iOS automation stuff. I am trying to capture the ios performance metrics like CPU usage while my automation script is running. I got below code to do this:

        HashMap<String, Object> args = new HashMap<>();
        args.put("timeout", 60000);
        args.put("pid", "current");
        args.put("profileName", "Time Profiler");
        driver.executeScript("mobile: startPerfRecord", args);

        // Did some actions on the device

         args = new HashMap<>();
        args.put("profileName", "Time Profiler");
        String b64Zip = (String)driver.executeScript("mobile: stopPerfRecord", args);
        byte[] bytesZip = Base64.getMimeDecoder().decode(b64Zip);
        File traceZip = new File("/path/to/");
        FileOutputStream stream = new FileOutputStream(traceZip);

Now, I am getting a .trace file generated at the given path once I execute the above code. I am able to open that .trace file using Instruments tool of xCode. The .trace file has the CPU usage data over the period of time . I want to use that data and draw my graph.

How can I parse that .trace file to extract the CPU usage data.

You have to use Xcode:

I think this is the only way Apple provides to look at this data. Xcode may be able to export in some way, but you would probably be best served by asking Apple in one of their support forums.