Example #1
0
int
procwalk()
{
    static int pwalk_per = 0;
    uint system_load = get_system_load(sampling);
    if (tillidle) {
        static uint idle_for_ms = 0;
        idle_for_ms = (system_load < idlecpu) ? idle_for_ms + millis : 0;
        idle = (idle_for_ms >= flag_after_ms);
    }

    count = 0;
    if (showmem) {
        SYSTEM_PERFORMANCE_INFORMATION sperf_info;
        if (get_system_performance_info(&sperf_info)) {
            fprintf (fp, "System committed memory (KB): %d / %d peak %d\n",
                     /* in pages so x4==KB */
                     4*sperf_info.TotalCommittedPages,
                     4*sperf_info.TotalCommitLimit,
                     4*sperf_info.PeakCommitment);
            /* FIXME: add physical memory, kernel memory, etc. */
        }
        fprintf (fp, "System load: %d%%\t\tUptime: %lu ms\n",
                 system_load, get_uptime());

        /* %user reaches 100% so we give it the extra column over %cpu */
        fprintf (fp, "%-23s %5s %7s %3s %4s %5s %3s %7s %7s %8s %7s %7s %7s %7s %5s %5s %5s %5s %5s",
                 "Name-Qualification", "PID", "DR  Bld", "CPU", "User", "Hndl", "Thr",
                 "PVSz", "VSz", "PPriv", "Priv",
                 "PWSS", "WSS", "Fault", "PPage", "Page", "PNonP", "NonP", "PPID");
        if (showtime)
            fprintf (fp, " %15s %15s %15s", "User Time(ms)", "Kernel Time(ms)",
                                            "Create Time(ms)");
        fprintf (fp, "\n");

    }
    if (pwalk_per == 0 || pwalk_per % showmemfreq == 0) {
        process_walk (&pw_callback, NULL);
        if (!count)
            fprintf (fp, "No such process found.\n");
        else {
            if (showmem && showtime) {
                fprintf (fp, "Total scheduled user/kernel time: %I64d/%I64d ms\n",
                         total_user/10000, total_kernel/10000);
            }
        }
    }
    pwalk_per++;

    total_user = 0;
    total_kernel = 0;

    return count;
}
Example #2
0
void CDynamoRIOView::EnumerateInstances()
{
    // clear all old data
    ClearData();
    m_ProcessList.ResetContent();

    m_list_pos = 0;
    process_walk(&pw_callback_under_dr, (void **)this);

    // now insert the 0th entry, the default selection
    if (m_ProcessList.GetCount() > 0) {
        m_ProcessList.InsertString(0, _T("<select an instance>"));
    } else {
        m_ProcessList.InsertString(0, _T("<no instances to view>"));
    }
    m_ProcessList.SetItemData(0, 0);
    m_ProcessList.SetCurSel(0);
    CString pname;
    m_ProcessList.GetLBText(m_ProcessList.GetCurSel(), pname);
    GetDocument()->SetTitle(pname);
}
Example #3
0
void
procwalk()
{
    process_walk(&pw_callback, NULL);
}