Súbor: [Platon] / ep / src / m_memory.c (stiahnutie)
Revízia 1.14, Fri Nov 28 17:35:11 2003 UTC (21 years, 5 months ago) by nepto
Zmeny od 1.13: +3 -3
[lines]
Changed URL from www.platon.sk to platon.sk.
|
/*
* ep - extended pipelining
*
* m_memory.c - ncurses memory menu item
* ____________________________________________________________
*
* Developed by Ondrej Jombik <nepto@platon.sk>
* and Lubomir Host <rajo@platon.sk>
* Copyright (c) 2000-2003 Platon SDG, http://platon.sk/
* All rights reserved.
*
* See README file for more information about this software.
* See COPYING file for license information.
*
* Download the latest version from
* http://platon.sk/projects/ep/
*/
/* $Platon: ep/src/m_memory.c,v 1.13 2003/05/03 09:58:19 nepto Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
#ifdef STDC_HEADERS
# include <ctype.h>
#endif
#if HAVE_MENU
# include <curses.h>
#include <signal.h>
#include "message.h"
#include "proctable.h"
int
menu_memory_info(p_ptbl, y, x)
PROCTABLE *p_ptbl;
int y;
int x;
{
int c, j, k;
struct mallinfo i;
chtype hbox = '-', vbox = '|';
int xsize = 32;
int ysize = 12;
WINDOW *win ;
char *str= (char *)malloc(1000*sizeof(char));
win = newwin(ysize, xsize, y, x);
if ( win == NULL ) {
msg_error_print("NULL pointer to WINDOW\n");
return 0;
}
wstandout(win);
wrefresh(win);
i=mallinfo();
sprintf(str, " Total arena space %8.1d \n"
" Ordinary blocks %8.1d \n"
// " Small blocks %8.1d \n"
" Holding blocks %8.1d \n"
" Space in headers %8.1d \n"
// " Small block use %8.1d \n"
// " Small blocks free %8.1d \n"
" Ordinary block use %8.1d \n"
" Ordinary block free %8.1d \n"
" Keep cost %8.1d ",
i.arena, i.ordblks, //i.smblks,
i.hblks, i.hblkhd, //i.usmblks,
/* i.fsmblks, */i.uordblks,
i.fordblks, i.keepcost);
mvwaddstr(win, 1, 0, str);
for (k=0; k<3; k++)
for (j=0; j<xsize; j++)
wprintw(win, " ");
wstandend(win);
wattrset(win, A_BOLD);
mvwaddstr(win, 9, (xsize - 6)/2, "[ OK ]");
wmove(win, 9, (xsize - 6)/2 + 2);
wstandout(win);
wborder(win, vbox, vbox, hbox, hbox, '+', '+', '+', '+');
wrefresh(win);
c = getch();
werase(win);
touchwin(win);
wrefresh(win);
delwin(win);
free(str);
return 0;
}
#endif /* #if HAVE_MENU */
// Total arena space * total space allocated from system *
// Ordinary blocks * number of non-inuse chunks *
// Small blocks * unused -- always zero *
// Holding blocks * number of mmapped regions *
// Space in headers * total space in mmapped regions *
// Small block use * unused -- always zero *
// Small blocks free * unused -- always zero *
// Ordinary block use * total allocated space *
// Ordinary block free * total non-inuse space *
// Keep cost * top-most, releasable (via malloc_trim) space *
Platon Group <platon@platon.sk> http://platon.sk/
|