int bmp_show_summary() { char bs[32]; char ms[32]; char up[32]; uptime_string(now.tv_sec - server.time.tv_sec, up, sizeof(up)); dprintf(out, "\n"); dprintf(out, "BMP Server (port %d)\n", server.port); dprintf(out, " BMP Server pid : %d\n", server.pid); dprintf(out, " BMP Server uptime : %s\n", up); dprintf(out, " Active BGP routers : %d\n", avl_size(server.sessions)); dprintf(out, " Active BGP peers : %d\n", 0); size_string(server.msgs, ms, sizeof(ms)); dprintf(out, " Total msgs rcv'd : %s\n", ms); bytes_string(server.bytes, bs, sizeof(bs)); dprintf(out, " Total data rcv'd : %s\n", bs); bytes_string(server.memory, bs, sizeof(bs)); dprintf(out, " Total memory usage : %s\n", bs); dprintf(out, "\n"); return 0; }
static int size_locks(Lock *l) { int sz = sizeof(int); /* for nlocks */ for (; l; l = l->next) { sz += size_string(l->name); sz += sizeof(l->added_by); } return sz; }
static int size_symbols(Object *o) { int i, sz = sizeof(o->nsymb) + sizeof(o->st_size); for (i = 0; i < o->nsymb; i++) { sz += sizeof(o->symbols[i].ref); if (o->symbols[i].ref) { sz += size_string(o->symbols[i].s); } } return sz; }
void S_alloc_init() { ISPC s; IGEN g; UINT i; if (S_boot_time) { /* reset the allocation tables */ for (s = 0; s <= max_real_space; s++) { for (g = 0; g <= static_generation; g++) { S_G.base_loc[s][g] = FIX(0); S_G.first_loc[s][g] = FIX(0); S_G.next_loc[s][g] = FIX(0); S_G.bytes_left[s][g] = 0; S_G.bytes_of_space[s][g] = 0; } } /* initialize the dirty-segment lists. */ for (i = 0; i < DIRTY_SEGMENT_LISTS; i += 1) { S_G.dirty_segments[i] = NULL; } S_G.collect_trip_bytes = default_collect_trip_bytes; /* set to final value in prim.c when known */ S_protect(&S_G.nonprocedure_code); S_G.nonprocedure_code = FIX(0); S_protect(&S_G.null_vector); find_room(space_new, 0, type_typed_object, size_vector(0), S_G.null_vector); VECTTYPE(S_G.null_vector) = (0 << vector_length_offset) | type_vector; S_protect(&S_G.null_fxvector); find_room(space_new, 0, type_typed_object, size_fxvector(0), S_G.null_fxvector); FXVECTOR_TYPE(S_G.null_fxvector) = (0 << fxvector_length_offset) | type_fxvector; S_protect(&S_G.null_bytevector); find_room(space_new, 0, type_typed_object, size_bytevector(0), S_G.null_bytevector); BYTEVECTOR_TYPE(S_G.null_bytevector) = (0 << bytevector_length_offset) | type_bytevector; S_protect(&S_G.null_string); find_room(space_new, 0, type_typed_object, size_string(0), S_G.null_string); STRTYPE(S_G.null_string) = (0 << string_length_offset) | type_string; } }
static int size_var(Var v) { switch (v.type) { case STR: return size_string(v.v.str) + 1; case NUM: return sizeof(v.v.num) + 1; case OBJ: return sizeof(v.v.obj.id) + sizeof(v.v.obj.server) + 1; case LIST: return size_list(v.v.list) + 1; case MAP: return size_map(v.v.map) + 1; case ERR: return sizeof(v.v.err) + 1; case PC: /* should never happen */ return 0; } return 0; /* should never happen */ }