diff --git a/sdk/automated/Makefile b/sdk/automated/Makefile index 97504367e8e975fca7678e7babe16d46ef18d4b6..2518b61ad0984faa64a43eb13868cdf3ce6072fb 100644 --- a/sdk/automated/Makefile +++ b/sdk/automated/Makefile @@ -16,6 +16,7 @@ DATA := backtrace.c \ leak.c \ linty.c \ multipath.c \ + sysprof-usage.xsl \ total-count.xsl TEST_NAME=sdk/automated diff --git a/sdk/automated/sysprof-usage.xsl b/sdk/automated/sysprof-usage.xsl new file mode 100644 index 0000000000000000000000000000000000000000..2d0ce4f652f83b0d2fec7582d66b91c55e4250c2 --- /dev/null +++ b/sdk/automated/sysprof-usage.xsl @@ -0,0 +1,35 @@ +<xsl:stylesheet version="1.1" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:exslt="http://exslt.org/common" + extension-element-prefixes="exslt"> + +<!-- + This transformation determines what percentage of the total samples + each task appeared in. + + Output: the percentage, number of samples and name of each task +--> + +<xsl:output method="text" /> + +<xsl:variable name="size"> + <!-- the total number of samples in this entire run --> + <xsl:for-each select="/profile/size"> + <!-- select the given value --> + <xsl:value-of select="."/> + </xsl:for-each> +</xsl:variable> + +<xsl:template match="@*|node()"> + <xsl:for-each select="/profile/objects/object"> + <xsl:if test="starts-with(name, '"[')"> + <xsl:value-of select="format-number(total div number($size) * 100, '#.##')"/> + <xsl:text>% </xsl:text> + <xsl:value-of select="total"/> + <xsl:text> </xsl:text> + <xsl:value-of select="name"/> + <xsl:text>
</xsl:text> + </xsl:if> + </xsl:for-each> +</xsl:template> +</xsl:stylesheet> diff --git a/sdk/automated/test-sysprof.sh b/sdk/automated/test-sysprof.sh index 5b4fb689485c02b423be63858578e756e65d0f83..5600cd05b93e8749b4e1c49a03ef83081d4d9c75 100755 --- a/sdk/automated/test-sysprof.sh +++ b/sdk/automated/test-sysprof.sh @@ -74,4 +74,7 @@ if [ "$STATUS_STR" = "FAILED" ]; then echo "Contents of $SYSPROF_OUT_FILE:" echo "" cat $SYSPROF_OUT_FILE + echo "" + echo "Samples by each process:" + xsltproc --nonet --novalid ${TEST_DIR}/sysprof-usage.xsl $SYSPROF_OUT_FILE | sort -n -r fi