#include #include #include #include #include #include #include #include #include #include #include #include void metrics_write(fp, this) output_ty *fp; metrics this; { if (!this) return; trace(("metrics_write(this = %08lX)\n{\n"/*}*/, this)); assert(((metrics)this)->reference_count > 0); trace(("rc = %d;\n", ((metrics)this)->reference_count)); metric_list_write(fp, "metrics", this->metrics); trace((/*{*/"}\n")); } static void *metrics_alloc _((void)); static void * metrics_alloc() { metrics this; trace(("metrics_alloc()\n{\n"/*}*/)); this = mem_alloc(sizeof(struct metrics)); this->reference_count = 1; this->mask = 0; this->metrics = 0; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } metrics metrics_copy(this) metrics this; { trace(("metrics_copy()\n{\n"/*}*/)); this->reference_count++; trace(("return %08lX;\n", (long)this)); trace((/*{*/"}\n")); return this; } static void metrics_free _((void *)); static void metrics_free(that) void *that; { metrics this = that; if (!this) return; this->reference_count--; assert(this->reference_count >= 0); if (this->reference_count > 0) return; trace(("metrics_free(this = %08lX)\n{\n"/*}*/, (long)this)); metric_list_type.free(this->metrics); mem_free(this); trace((/*{*/"}\n")); } static type_table_ty metrics_table[] = { { "metrics", offsetof(struct metrics, metrics), &metric_list_type, metrics_metrics_mask, }, }; static void *metrics_parse _((void *, string_ty *, type_ty **, unsigned long *)); static void * metrics_parse(this, name, type_pp, mask_p) void *this; string_ty *name; type_ty **type_pp; unsigned long *mask_p; { void *addr; trace(("metrics_parse(this = %08lX, name = %08lX, type_pp = %08lX)\n{\n"/*}*/, (long)this, (long)name, (long)type_pp)); assert(((metrics)this)->reference_count > 0); assert(sizeof(metrics) == sizeof(generic_struct_ty *)); addr = generic_struct_parse ( this, name, type_pp, mask_p, metrics_table, SIZEOF(metrics_table) ); trace((/*{*/"return %08lX;\n}\n", (long)addr)); return addr; } static string_ty *metrics_fuzzy _((string_ty *)); static string_ty * metrics_fuzzy(name) string_ty *name; { string_ty *result; trace(("metrics_fuzzy(name = %08lX)\n{\n"/*}*/, (long)name)); result = generic_struct_fuzzy ( name, metrics_table, SIZEOF(metrics_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } static struct rpt_value_ty *metrics_convert _((void *)); static struct rpt_value_ty * metrics_convert(this) void *this; { struct rpt_value_ty *result; trace(("metrics_convert(name = %08lX)\n{\n"/*}*/, (long)this)); assert(((metrics)this)->reference_count > 0); result = generic_struct_convert ( this, metrics_table, SIZEOF(metrics_table) ); trace(("return %08lX;\n", (long)result)); trace((/*{*/"}\n")); return result; } type_ty metrics_type = { "metrics", metrics_alloc, metrics_free, 0, /* enum_parse */ 0, /* list_parse */ metrics_parse, metrics_fuzzy, metrics_convert, generic_struct_is_set, }; metrics metrics_read_file(filename) string_ty *filename; { metrics result; trace(("metrics_read_file(filename = \"%s\")\n{\n"/*}*/, (filename ? filename->str_text : ""))); os_become_must_be_active(); result = parse(filename, &metrics_type); trace(("return %08lX;\n", result)); trace((/*{*/"}\n")); return result; } void metrics_write_file(filename, value, compress) string_ty *filename; metrics value; int compress; { output_ty *fp; trace(("metrics_write_file(filename = \"%s\", value = %08lX)\n{\n"/*}*/, (filename ? filename->str_text : ""), (long)value)); if (filename) os_become_must_be_active(); if (compress) { fp = output_file_binary_open(filename); fp = output_gzip(fp); } else { fp = output_file_text_open(filename); } fp = output_indent(fp); io_comment_emit(fp); metrics_write(fp, value); type_enum_option_clear(); output_delete(fp); trace((/*{*/"}\n")); } void metrics__rpt_init() { trace(("metrics__rpt_init()\n{\n"/*}*/)); trace((/*{*/"}\n")); }