Export instruments trace data via command-line for leaks - ios

I am using the following script to run leaks instruments from the command-line.
instruments -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Resources/templates/Leaks.tracetemplate <app path>
after executing the command, i get instrumentscli0.trace file. How can i get readable data about leaks from that file.
Is there any way to export the results to a text file via any command. In automation template we can specify an output folder using the switch -e UIARESULTSPATH.

you can click "instrument > export data" in the menu to export the recent result to a .csv file. but i don't know how to do it with command line

Related

Instruments > Automation - Script and Editor Log open simultaneously

In the Instruments Automation tool, is it possible to have the Script and Editor Log panes open simultaneously (e.g. vertically split)?
No :)
I recommend to edit script in an external editor and then run via console. That's easy:
instruments -w "iPad Air" -t "Automation" ~/My.app -e UIASCRIPT my_script.js
To add on this, please make sure you export the script first if you created it within the trace document and then delete it form the trace document. If you do not do that, it will be overwritten when you reopen the trace document with instruments.

How to automatically export Instruments data to CSV

I'm looking at a way to automate the gathering of iOS memory usage. So far, I've been using the Instruments cli to do this:
instruments -w <ID> -t "/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Resources/templates/Activity Monitor.tracetemplate" -l 30000
My problem now is exporting the data to be parsed. I noticed in the Instruments GUI there is an option to export to CSV, however there doesn't appear to be anything like this for the CLI.
I unzipped the .trace package that the Instruments CLI outputs and found a lot of binary data, which isn't too useful.
Is it possible to export this data or convert it to a parsable format?
Thanks

How to run instruments with new instances from the command line?

I want to have the ability to run scripts on multiple devices with instruments at the same time.
I found that if I open new instances of instrument (File -> New),
I could run many scripts on different devices at the same time, but I need to run this from the command line.
I have the command:
instruments -t mytemplate myapp.app
and I can add to this:
-i # The index of the instrument to apply.
how can I find the index of instrument?
or how do I tell the command line to run a script on a specific instance of instruments?

IOS project code coverage source file is relative path

I have generated .gcno and .gcda files after running my iphone app.Then I use cover story to view the coverage rate.However, cover story could not open the source file and I found that the source path is a relative path, not full path.All I can see is full of /EOF/ in the screen.
The strange to me is that only some of the files could not open due to this path issue. Most of them are full path and cover story can open them successfully.Unable to attach screenshot
How can I show the correct path names in CoverStory?
I suggest generating an HTML report with lcov, which allos you to normalize the directory names.
Other benefits of using an HTML report are:
The coverage information is available on both desktop machines as well as from a Continuous Integration build server.
To install lcov
Use Homebrew or MacPorts
Example:
brew install lcov
First Generate Datafile
#!/bin/bash
set -e # fail script if any commands fail
${gen.info} ${temp.dir}/coverage-data/*.gcno --no-recursion --output-filename \
${temp.dir}/${module.name}-temp.info
#Remove symbols we're not interested in.
${lcov} -r ${temp.dir}/${module.name}-temp.info > ${temp.dir}/${module.name}.info
Now Generate the HTML Report
#!/bin/bash
set -e # fail script if any commands fail
${gen.html} --no-function-coverage --no-branch-coverage -o ${coverage.reports.dir} \
--prefix ${basedir} ${temp.dir}/${module.name}.info
If you're interested, I have an build script the produces HTML reports here. An example report: http://jasperblues.github.io/Typhoon/coverage/index.html

save .trace file to a different location

I'm running instruments from command line. In my command, i did specified the output path
using
-e UIARESULTSPATH /user/xxxx
However, the files saved to the location above are plist liles. the .trace (ie. instrumentscli14.trace) files are automatically saved to the folder i save my scripts.
Do anyone know is there a way to save the .trace files to a custom location?
Thanks!
Do anyone know is there a way to save the .trace files to a custom
location?
Use the -D option, like this:
-D TestResults/TestTrace/theTrace.trace
I found that -D option is not working, but instruments saves trace file to current directory where you run command from..

Resources