bug no. 3386184

This commit is contained in:
h_vogt 2011-08-06 07:53:48 +00:00
parent 94a4e45d08
commit 36f6eb6a89
5 changed files with 3126 additions and 3051 deletions

View File

@ -1,3 +1,7 @@
2011-08-06 Holger Vogt
* inpcom.c: code beautify, bug no. 3386184
* resource.c, resource.h, com_sysinfo.c: replace size_t by unsigned long long
2011-08-05 Robert Larice 2011-08-05 Robert Larice
* src/spicelib/devices/dev.c : * src/spicelib/devices/dev.c :
type fix for Visual Studio type fix for Visual Studio

View File

@ -54,10 +54,10 @@ typedef struct TSI {
/* memory info */ /* memory info */
struct sys_memory { struct sys_memory {
size_t size_m; /* Total memory size */ unsigned long long size_m; /* Total memory size */
size_t free_m; /* Free memory */ unsigned long long free_m; /* Free memory */
size_t swap_t; /* Swap total */ unsigned long long swap_t; /* Swap total */
size_t swap_f; /* Swap free */ unsigned long long swap_f; /* Swap free */
}; };
static struct sys_memory mem_t_act; static struct sys_memory mem_t_act;
@ -67,11 +67,11 @@ static size_t get_sysmem(struct sys_memory *memall);
/* Print to stream the given memory size in a human friendly format */ /* Print to stream the given memory size in a human friendly format */
static void static void
fprintmem(FILE* stream, size_t memory) { fprintmem(FILE* stream, unsigned long long memory) {
if (memory > (1<<20)) if (memory > 1048576)
fprintf(stream, "%8.6f MB", (double)memory / (1<<20)); fprintf(stream, "%8.6f MB", (double)memory /1048576.);
else if (memory > (1<<10)) else if (memory > 1024)
fprintf(stream, "%5.3f kB", (double)memory / (1<<10)); fprintf(stream, "%5.3f kB", (double)memory / 1024.);
else else
fprintf(stream, "%u bytes", (unsigned)memory); fprintf(stream, "%u bytes", (unsigned)memory);
} }

File diff suppressed because it is too large Load Diff

View File

@ -71,7 +71,7 @@ $Id$
/* static declarations */ /* static declarations */
static void printres(char *name); static void printres(char *name);
static void fprintmem(FILE* stream, size_t memory); static void fprintmem(FILE* stream, unsigned long long memory);
#if defined(HAVE_WIN32) || defined(HAVE__PROC_MEMINFO) #if defined(HAVE_WIN32) || defined(HAVE__PROC_MEMINFO)
static size_t get_procm(struct proc_mem *memall); static size_t get_procm(struct proc_mem *memall);
@ -148,7 +148,7 @@ char* copyword;
void void
ft_ckspace(void) ft_ckspace(void)
{ {
size_t usage, limit; unsigned long long usage, limit;
#if defined(HAVE_WIN32) || defined(HAVE__PROC_MEMINFO) #if defined(HAVE_WIN32) || defined(HAVE__PROC_MEMINFO)
get_procm(&mem_ng_act); get_procm(&mem_ng_act);
@ -455,7 +455,7 @@ printres(char *name)
/* Print to stream the given memory size in a human friendly format */ /* Print to stream the given memory size in a human friendly format */
static void static void
fprintmem(FILE* stream, size_t memory) { fprintmem(FILE* stream, unsigned long long memory) {
if (memory > 1048576) if (memory > 1048576)
fprintf(stream, "%8.6f MB", (double)memory / 1048576.); fprintf(stream, "%8.6f MB", (double)memory / 1048576.);
else if (memory > 1024) else if (memory > 1024)

View File

@ -12,20 +12,20 @@ void com_rusage(wordlist *wl);
struct proc_mem { struct proc_mem {
size_t size; /* Total ngspice program size */ unsigned long long size; /* Total ngspice program size */
size_t resident;/* Resident set size */ unsigned long long resident;/* Resident set size */
size_t shared; /* Shared ngspice pages */ unsigned long long shared; /* Shared ngspice pages */
size_t trs; /* Text (code) pages */ unsigned long long trs; /* Text (code) pages */
size_t drs; /* Stack */ unsigned long long drs; /* Stack */
size_t lrs; /* Library pages */ unsigned long long lrs; /* Library pages */
size_t dt; /* Dirty pages (not used in kernel 2.6) */ unsigned long long dt; /* Dirty pages (not used in kernel 2.6) */
}; };
struct sys_mem { struct sys_mem {
size_t size; /* Total memory size */ unsigned long long size; /* Total memory size */
size_t free; /* Free memory */ unsigned long long free; /* Free memory */
size_t swap_t; /* Swap total */ unsigned long long swap_t; /* Swap total */
size_t swap_f; /* Swap free */ unsigned long long swap_f; /* Swap free */
}; };
#endif #endif