mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
use skynet_error for memory dump
This commit is contained in:
@@ -106,7 +106,7 @@ mallctl_int64(const char* name, size_t* newval) {
|
|||||||
} else {
|
} else {
|
||||||
je_mallctl(name, &v, &len, NULL, 0);
|
je_mallctl(name, &v, &len, NULL, 0);
|
||||||
}
|
}
|
||||||
// printf("name: %s, value: %zd\n", name, v);
|
// skynet_error(NULL, "name: %s, value: %zd\n", name, v);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,9 +117,9 @@ mallctl_opt(const char* name, int* newval) {
|
|||||||
if(newval) {
|
if(newval) {
|
||||||
int ret = je_mallctl(name, &v, &len, newval, sizeof(int));
|
int ret = je_mallctl(name, &v, &len, newval, sizeof(int));
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
printf("set new value(%d) for (%s) succeed\n", *newval, name);
|
skynet_error(NULL, "set new value(%d) for (%s) succeed\n", *newval, name);
|
||||||
} else {
|
} else {
|
||||||
printf("set new value(%d) for (%s) failed: error -> %d\n", *newval, name, ret);
|
skynet_error(NULL, "set new value(%d) for (%s) failed: error -> %d\n", *newval, name, ret);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
je_mallctl(name, &v, &len, NULL, 0);
|
je_mallctl(name, &v, &len, NULL, 0);
|
||||||
@@ -196,15 +196,15 @@ void
|
|||||||
dump_c_mem() {
|
dump_c_mem() {
|
||||||
int i;
|
int i;
|
||||||
size_t total = 0;
|
size_t total = 0;
|
||||||
printf("dump all service mem:\n");
|
skynet_error(NULL, "dump all service mem:");
|
||||||
for(i=0; i<SLOT_SIZE; i++) {
|
for(i=0; i<SLOT_SIZE; i++) {
|
||||||
mem_data* data = &mem_stats[i];
|
mem_data* data = &mem_stats[i];
|
||||||
if(data->handle != 0 && data->allocated != 0) {
|
if(data->handle != 0 && data->allocated != 0) {
|
||||||
total += data->allocated;
|
total += data->allocated;
|
||||||
printf("0x%x -> %zdkb\n", data->handle, data->allocated >> 10);
|
skynet_error(NULL, "0x%x -> %zdkb", data->handle, data->allocated >> 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("+total: %zdkb\n",total >> 10);
|
skynet_error(NULL, "+total: %zdkb",total >> 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
|||||||
Reference in New Issue
Block a user