The powerprofile and systrace outputs are not consistent

171 views Asked by At

I'm generating the PowerProflie file and the Systrace file to get the energy consumption of an Android Application, but I found that the number of cpu cores is different between the two files.

I'm using this command line for Systrace:

command = "python " + platformToolsFolder + "/systrace/systrace.py --time=" + this.timeCapturing + " freq idle -o " + this.systraceFilename;

and for PowerProfile :

this.executeCommand("java -jar apktool_2.2.2.jar if framework-res.apk", null);
this.executeCommand("java -jar apktool_2.2.2.jar d framework-res.apk", null);
this.executeCommand("mv " + jarDirectory + "/framework-res/res/xml/power_profile.xml " + outputLocation, null);
    

this is a part of the PowerProfile file I've got :

  <item name="radio.active">320</item>
<item name="radio.scanning">5.8</item>
<array name="radio.on">
    <value>5.8</value>
    <value>5.8</value>
</array>
<item name="modem.controller.idle">5.8</item>
<item name="modem.controller.rx">226</item>
<item name="modem.controller.tx">226</item>
<item name="modem.controller.voltage">4.0</item>
<array name="cpu.clusters.cores">
    <value>4</value>
</array>
<array name="cpu.speeds.cluster0">
    <value>850000</value>
    <value>918000</value>
    <value>987000</value>
    <value>1056000</value>
    <value>1125000</value>
    <value>1216000</value>
    <value>1308000</value>
    <value>1400000</value>
    <value>1466000</value>
    <value>1533000</value>
    <value>1633000</value>
    <value>1700000</value>
    <value>1767000</value>
    <value>1834000</value>
    <value>1917000</value>
    <value>2001000</value>
</array>
<array name="cpu.active.cluster0">
    <value>9.3</value>
    <value>9.3</value>
    <value>10.6</value>
    <value>11.6</value>
    <value>13.3</value>
    <value>15.0</value>
    <value>17.2</value>
    <value>20.2</value>
    <value>22.8</value>
    <value>26.3</value>
    <value>27.4</value>
    <value>29.7</value>
    <value>30.2</value>
    <value>32.1</value>
    <value>33.9</value>
    <value>38.5</value>
</array>
<item name="cpu.idle">4.1</item>
<array name="memory.bandwidths">
    <value>1.3</value>
</array>
<item name="battery.capacity">3500</item>
<item name="wifi.controller.idle">4.9</item>
<item name="wifi.controller.rx">72.3</item>
<item name="wifi.controller.tx">72.3</item>
<array name="wifi.controller.tx_levels" />
<item name="wifi.controller.voltage">4.0</item>
<array name="wifi.batchedscan">
    <value>64.2</value>
    <value>64.2</value>
    <value>64.2</value>
    <value>64.2</value>
    <value>64.2</value>
</array>

and this is a part of my Systrace file :

      <idle>-0     (-----) [002] d..1 51825.602557: cpu_idle: state=4294967295 cpu_id=2
      <idle>-0     (-----) [002] d..1 51825.602791: cpu_idle: state=1 cpu_id=2
      <idle>-0     (-----) [006] d..1 51825.602869: cpu_idle: state=4294967295 cpu_id=6
      <idle>-0     (-----) [005] dn.1 51825.602907: cpu_idle: state=4294967295 cpu_id=5
      <idle>-0     (-----) [006] d..1 51825.602915: cpu_idle: state=0 cpu_id=6
  ipi_cpu_dvfs_rt-251   (  251) [005] .... 51825.602942: cpu_frequency: state=900000 cpu_id=0
      <idle>-0     (-----) [004] dn.1 51825.602989: cpu_idle: state=4294967295 cpu_id=4
  ipi_cpu_dvfs_rt-251   (  251) [005] .... 51825.602994: cpu_frequency: state=900000 cpu_id=1
  ipi_cpu_dvfs_rt-251   (  251) [005] .... 51825.603000: cpu_frequency: state=900000 cpu_id=2
  ipi_cpu_dvfs_rt-251   (  251) [005] .... 51825.603003: cpu_frequency: state=900000 cpu_id=3
      <idle>-0     (-----) [005] d..1 51825.603034: cpu_idle: state=0 cpu_id=5
      <idle>-0     (-----) [004] d..1 51825.603100: cpu_idle: state=0 cpu_id=4
      <idle>-0     (-----) [004] d..1 51825.607831: cpu_idle: state=4294967295 cpu_id=4
      <idle>-0     (-----) [005] dn.1 51825.608429: cpu_idle: state=4294967295 cpu_id=5
      <idle>-0     (-----) [006] dn.1 51825.608549: cpu_idle: state=4294967295 cpu_id=6
      <idle>-0     (-----) [005] d..1 51825.608610: cpu_idle: state=0 cpu_id=5
      <idle>-0     (-----) [005] d..1 51825.608615: cpu_idle: state=4294967295 cpu_id=5
      <idle>-0     (-----) [005] d..1 51825.608618: cpu_idle: state=0 cpu_id=5
      <idle>-0     (-----) [006] d..1 51825.608654: cpu_idle: state=0 cpu_id=6
      <idle>-0     (-----) [004] d..1 51825.608688: cpu_idle: state=1 cpu_id=4
      <idle>-0     (-----) [006] d..1 51825.608974: cpu_idle: state=4294967295 cpu_id=6
      <idle>-0     (-----) [005] dn.1 51825.609108: cpu_idle: state=4294967295 cpu_id=5
      <idle>-0     (-----) [006] d..1 51825.609129: cpu_idle: state=0 cpu_id=6
      <idle>-0     (-----) [005] d..1 51825.609136: cpu_idle: state=0 cpu_id=5
      <idle>-0     (-----) [007] d..1 51825.610061: cpu_idle: state=4294967295 cpu_id=7

As you can see in the power profile file I have 4 cpu cores (cpu.clusters.cores=4) but in Systrace file I have 8 cpu cores (cpu_id=0-7) and most of cpu frequencies (cpu_frequency) in Systrace file doesn't exist in powerprofile file (cpu.speeds.cluster0) so I can't get the energy consumed, Please let me know if you have any solution for this.

1

There are 1 answers

2
Yi Yang On BEST ANSWER

Systrace is likely right here in terms of CPU core count. You can run adb shell ls /sys/devices/system/cpu to see how many cores there are on your device.

power_profile.xml is provided by OEMs so the values may be off. cpu.clusters.cores shows CPU cores in clusters (modern mobile devices have big/small cores) so for a typical 8 core device, it should look like this:

<array name="cpu.clusters.cores">
    <value>4</value>
    <value>4</value>
</array>

Looks like only values for the first cluster is provided in your power_profile.xml.