| 982 | } |
| 983 | |
| 984 | static void |
| 985 | stats_general_print(emitter_t *emitter) { |
| 986 | const char *cpv; |
| 987 | bool bv, bv2; |
| 988 | unsigned uv; |
| 989 | uint32_t u32v; |
| 990 | uint64_t u64v; |
| 991 | ssize_t ssv, ssv2; |
| 992 | size_t sv, bsz, usz, ssz, sssz, cpsz; |
| 993 | |
| 994 | bsz = sizeof(bool); |
| 995 | usz = sizeof(unsigned); |
| 996 | ssz = sizeof(size_t); |
| 997 | sssz = sizeof(ssize_t); |
| 998 | cpsz = sizeof(const char *); |
| 999 | |
| 1000 | CTL_GET("version", &cpv, const char *); |
| 1001 | emitter_kv(emitter, "version", "Version", emitter_type_string, &cpv); |
| 1002 | |
| 1003 | /* config. */ |
| 1004 | emitter_dict_begin(emitter, "config", "Build-time option settings"); |
| 1005 | #define CONFIG_WRITE_BOOL(name) \ |
| 1006 | do { \ |
| 1007 | CTL_GET("config."#name, &bv, bool); \ |
| 1008 | emitter_kv(emitter, #name, "config."#name, \ |
| 1009 | emitter_type_bool, &bv); \ |
| 1010 | } while (0) |
| 1011 | |
| 1012 | CONFIG_WRITE_BOOL(cache_oblivious); |
| 1013 | CONFIG_WRITE_BOOL(debug); |
| 1014 | CONFIG_WRITE_BOOL(fill); |
| 1015 | CONFIG_WRITE_BOOL(lazy_lock); |
| 1016 | emitter_kv(emitter, "malloc_conf", "config.malloc_conf", |
| 1017 | emitter_type_string, &config_malloc_conf); |
| 1018 | |
| 1019 | CONFIG_WRITE_BOOL(opt_safety_checks); |
| 1020 | CONFIG_WRITE_BOOL(prof); |
| 1021 | CONFIG_WRITE_BOOL(prof_libgcc); |
| 1022 | CONFIG_WRITE_BOOL(prof_libunwind); |
| 1023 | CONFIG_WRITE_BOOL(stats); |
| 1024 | CONFIG_WRITE_BOOL(utrace); |
| 1025 | CONFIG_WRITE_BOOL(xmalloc); |
| 1026 | #undef CONFIG_WRITE_BOOL |
| 1027 | emitter_dict_end(emitter); /* Close "config" dict. */ |
| 1028 | |
| 1029 | /* opt. */ |
| 1030 | #define OPT_WRITE(name, var, size, emitter_type) \ |
| 1031 | if (je_mallctl("opt."name, (void *)&var, &size, NULL, 0) == \ |
| 1032 | 0) { \ |
| 1033 | emitter_kv(emitter, name, "opt."name, emitter_type, \ |
| 1034 | &var); \ |
| 1035 | } |
| 1036 | |
| 1037 | #define OPT_WRITE_MUTABLE(name, var1, var2, size, emitter_type, \ |
| 1038 | altname) \ |
| 1039 | if (je_mallctl("opt."name, (void *)&var1, &size, NULL, 0) == \ |
| 1040 | 0 && je_mallctl(altname, (void *)&var2, &size, NULL, 0) \ |
| 1041 | == 0) { \ |
no test coverage detected