Logo Search packages:      
Sourcecode: virtualbox-ose version File versions

static void KPRF_NAME() HtmlWriteSortedFunctions ( KPRF_TYPE(P, REPORT)  pReport,
FILE *  pOut,
const char *  pszName,
const char *  pszTitle,
KPRF_TYPE(, FIRSTCOLUMN)  enmFirst 
) [static]

Prints the table with the sorted functions. The tricky bit is that the sorted column should be to the left of the function name.

Definition at line 1096 of file prfreader.cpp.h.

References KPRF_NAME, and KPRF_TYPE.

Referenced by WriteHtmlReport().

{
    fprintf(pOut,
            "<h2><a name=\"%s\">%s</a></h2>\n"
            "\n",
            pszName, pszTitle);

    fprintf(pOut,
            "<table class=\"FunctionsSorted\">\n"
            "  <tr>\n"
            "    <th/>\n");
    static const char *s_pszHeaders[KPRF_TYPE(,FIRSTCOLUMN_MAX) * 2] =
    {
        "    <th colspan=8><a href=\"#Functions-TimeOnStack\">Time On Stack</a> (ticks)</th>\n",
        "    <th colspan=2><a href=\"#Functions-TimeOnStack\">Sum</a></th>\n"
        "    <th colspan=2><a href=\"#Functions-TimeOnStack-Min\">Min</a></th>\n"
        "    <th colspan=2><a href=\"#Functions-TimeOnStack-Avg\">Average</a></th>\n"
        "    <th colspan=2><a href=\"#Functions-TimeOnStack-Max\">Max</a></th>\n",

        "    <th colspan=8><a href=\"#Functions-TimeOnTopOfStack\">Time On To Top</a> (ticks)</th>\n",
        "    <th colspan=2><a href=\"#Functions-TimeOnTopOfStack\">Sum</a></th>\n"
        "    <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Min\">Min</a></th>\n"
        "    <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Avg\">Average</a></th>\n"
        "    <th colspan=2><a href=\"#Functions-TimeOnTopOfStack-Max\">Max</a></th>\n",

        "    <th colspan=2><a href=\"#Functions-CallsTo\">Calls To</a></th>\n",
        "    <th/><th/>\n",

        "    <th colspan=2><a href=\"#Functions-CallsFrom\">Calls From</a></th>\n",
        "    <th/><th/>\n",
    };

    fprintf(pOut, "%s",  s_pszHeaders[enmFirst * 2]);
    fprintf(pOut, "    <th>Function</th>\n");
    for (unsigned i = (enmFirst + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); i != enmFirst; i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX))
        fprintf(pOut, "%s",  s_pszHeaders[i * 2]);
    fprintf(pOut,
            "  </tr>\n"
            "  <tr>\n"
            "    <th/>\n");
    fprintf(pOut, "%s",  s_pszHeaders[enmFirst * 2 + 1]);
    fprintf(pOut, "    <th/>\n");
    for (unsigned i = (enmFirst + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX); i != enmFirst; i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX))
        fprintf(pOut, "%s",  s_pszHeaders[i * 2 + 1]);
    fprintf(pOut,
            "  </tr>\n");

    for (KU32 iFunc = 0; iFunc < pReport->pHdr->cFunctions; iFunc++)
    {
        KPRF_TYPE(P,REPORTFUNC) pReportFunc = pReport->papSortedFunctions[iFunc];
        KPRF_TYPE(PC,FUNC) pFunc = pReportFunc->pFunc;
        fprintf(pOut,
                "  <tr>\n"
                "    <td>%u</td>\n",
               iFunc);

        unsigned i = enmFirst;
        do
        {
            switch (i)
            {
                case KPRF_TYPE(,FIRSTCOLUMN_ON_STACK):
                    fprintf(pOut,
                            "    <td class=\"Ticks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnStack.SumTicks);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.SumTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n"
                            "    <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnStack.MinTicks);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MinTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n"
                            "    <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnStack.SumTicks / pFunc->cOnStack);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MinTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n"
                            "    <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnStack.MaxTicks);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnStack.MaxTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n");
                    break;

                case KPRF_TYPE(,FIRSTCOLUMN_ON_TOP_OF_STACK):
                    fprintf(pOut,
                            "    <td class=\"Ticks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnTopOfStack.SumTicks);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.SumTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n"
                            "    <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnTopOfStack.MinTicks);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MinTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n"
                            "    <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnTopOfStack.SumTicks / pFunc->cOnStack);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MinTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n"
                            "    <td class=\"MinMaxTicks\">%" KPRF_FMT_U64 "</td><td class=\"Parts\">",
                            pFunc->OnTopOfStack.MaxTicks);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->OnTopOfStack.MaxTicks, pReport->ProfiledTicks);
                    fprintf(pOut,       "</td>\n");
                    break;

                case KPRF_TYPE(,FIRSTCOLUMN_CALLS_TO):
                    fprintf(pOut,
                            "    <td class=\"Calls\">%" KPRF_FMT_U64 "</td><td Class=\"Parts\">",
                            pFunc->cOnStack);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->cOnStack, pReport->cCalls);
                    fprintf(pOut,       "</td>\n");
                    break;

                case KPRF_TYPE(,FIRSTCOLUMN_CALLS_FROM):
                    fprintf(pOut,
                            "    <td class=\"Calls\">%" KPRF_FMT_U64 "</td><td Class=\"Parts\">",
                            pFunc->cCalls);
                    KPRF_NAME(HtmlWriteParts)(pOut, pFunc->cOnStack, pReport->cCalls);
                    fprintf(pOut,       "</td>\n");
                    break;

                default:
                    break;
            }

            /* inject the function column */
            if (i == enmFirst)
            {
                fprintf(pOut,
                        "    <td><a href=\"#Func-%u\">",
                        pReportFunc - pReport->paFunctions);
                if (pReportFunc->pSym)
                    fprintf(pOut, "%s</a></td>\n", pReportFunc->pSym->szName);
                else
                    fprintf(pOut, "%" KPRF_FMT_UPTR "</a></td>\n", pFunc->uEntryPtr);
            }

            /* next */
            i = (i + 1) % KPRF_TYPE(,FIRSTCOLUMN_MAX);
        } while (i != enmFirst);

        fprintf(pOut,
                "  </tr>\n");
    }
    fprintf(pOut,
            "</table>\n"
            "\n");

}


Generated by  Doxygen 1.6.0   Back to index