Arm Code Advisor plug-in API data streams

Your plug-ins can consume data streams - sources of data produced by Code Advisor or other plug-ins. Your plug-ins can also produce data streams which it sends back to Code Advisor. The following data streams are available for use by your plug-ins:

  • armcadvisor:issues - To produce issues
  • armcadvisor:samples - To generate samples
  • armcadvisor:files - To provide information about the samples in a file

 Data streams are defined in the plugins.proto file, located in /opt/arm/<version>/share/proto-files

armcadvisor:issues

Use this data stream to produce or consume issues. The following data structure is available for the armcadvisor:issues data stream.

Field  Type Required Description
id  string yes A unique ID for this issue
rank  unsigned integer no The rank of this issue (1-10 with 10 being high)
type  string yes The type of this issue (advice or info)
categories  repeated string no (multiple permitted) The category of this issue
title  string yes The title of this issue
description.html  string no A description (in html) of this issue
description.plain  string no A plaintext description of this issue
position.source_path  string yes The path to the source file where this issue occurs (currently both relative and absolute paths are supported)
position.start_line  integer no The line where this issue occurs
position.end_line  integer no The last line of the issue (if the issue spans multiple lines)
position.start_column  integer no If the issue pertains to part of a line, this is the column it starts
position.end_column  integer no If the issue pertains to part of a line, this is the column it ends
related_issues.next  string no The next related issue ID
related_issue.previous  string no The previous related issue ID
related_issues.other  repeated string no (multiple permitted) The IDs of other related issues

Example

issue = Issue()
        issue.id = "issue {}".format(i)

        issue.type = ["info", "advice"][i % 2]
        issue.categories.append("fish")
        issue.title = "AN ISSUE CALLED {}".format(i)
        issue.position.source_path = "/my_location/folder"

Samples

Use this data stream to generate samples.
The following data structure is available in the armcadvisor:samples data stream.

Field Required Description
header.misc no
header.cpu no The source CPU of this perf record
header.pid yes The source process id of this perf record
header.tid no The source thread of this perf record
header.time yes The time this perf record was recorded
instruction_pointer yes The address of this sample
stack_pointers no, repeated The stack backtrace

Example

sample = Sample()
        sample.header.cpu = randint(0, 96)
        sample.header.pid = randint(1, 256)
        sample.header.time = int(time.time())
        sample.instruction_pointer = 0x13

File summary

Use this data stream to provide information about the samples in a file.
The following data structure is available in the armcadvisor:files data stream:

Field Required Description
file_name yes The name of the file
functions no, map A map of function names to samples landing in them
lines no, map A map of line numbers to samples landing on them
symbols no, map A map of symbols detailing their locations