remove get_free_memory function. Is useless on modern systems

This commit is contained in:
roberto@sirius.local
2010-02-04 14:02:30 +01:00
parent 595e99a0c6
commit a6b42af85a
3 changed files with 0 additions and 51 deletions
-45
View File
@@ -1,11 +1,5 @@
#include "uwsgi.h"
#ifdef __APPLE__
#include <mach/host_info.h>
#include <mach/mach_host.h>
#endif
extern struct uwsgi_server uwsgi;
#ifdef __BIG_ENDIAN__
@@ -137,42 +131,3 @@ char * uwsgi_get_cwd() {
return cwd;
}
uint64_t get_free_memory() {
uint64_t freemem = 0 ;
#ifdef __APPLE__
vm_statistics_data_t page_info;
mach_msg_type_number_t count;
count = HOST_VM_INFO_COUNT;
if (host_statistics (mach_host_self(), HOST_VM_INFO, (host_info_t)&page_info, &count) == KERN_SUCCESS){
freemem += (page_info.inactive_count + page_info.free_count) * uwsgi.page_size ;
}
#elif defined(__linux__)
/* sadly linux has no api for getting the current size of page cache. we need to parse /proc/meminfo */
FILE *meminfo;
meminfo = fopen("/proc/meminfo", "r");
if (!meminfo) {
perror("fopen()");
}
else {
}
#elif defined(__FreeBSD__)
int value ;
size_t dlen;
if (sysctlbyname("vm.stats.vm.v_free_count", &value, &dlen, NULL, 0) != 0) {
perror("sysctlbyname()");
}
else {
freemem += value*uwsgi.page_size ;
}
#endif
return freemem ;
}
-4
View File
@@ -964,8 +964,6 @@ int main(int argc, char *argv[], char *envp[]) {
uwsgi.page_size = getpagesize();
fprintf(stderr,"your memory page size is %d bytes\n", uwsgi.page_size);
fprintf(stderr,"your system has %llu megabytes of free memory\n", get_free_memory()/1024/1024);
#ifndef UNBIT
fprintf(stderr,"your server socket listen backlog is limited to %d connections\n", uwsgi.listen_queue);
#endif
@@ -1328,8 +1326,6 @@ int main(int argc, char *argv[], char *envp[]) {
uwsgi.workers[0].current_workers = uwsgi.numproc ;
/* print memory usage after module initialization */
fprintf(stderr,"you system has now %llu megabytes of free memory\n", get_free_memory()/1024/1024);
if (!uwsgi.master_process && uwsgi.numproc == 1) {
fprintf(stderr, "spawned uWSGI worker 1 (and the only) (pid: %d)\n", masterpid);
-2
View File
@@ -366,8 +366,6 @@ void init_uwsgi_module_sharedarea(PyObject *);
void init_uwsgi_module_advanced(PyObject *);
void init_uwsgi_module_spooler(PyObject *);
uint64_t get_free_memory(void);
#ifndef ROCK_SOLID
int spool_request(char *, int, char *, int);
void spooler(PyObject *);