static VALUE trace_new(VALUE klass, VALUE start, VALUE uuid, VALUE endpoint) { sky_trace_t* trace; UNUSED(klass); CHECK_NUMERIC(start); CHECK_TYPE(uuid, T_STRING); CHECK_TYPE(endpoint, T_STRING); CHECK_FFI( sky_trace_new(NUM2ULL(start), STR2BUF(uuid), STR2BUF(endpoint), &trace), "native Trace#new failed"); sky_clear_allocation_count(); return Data_Wrap_Struct(rb_cTrace, NULL, sky_trace_free, trace); }
static VALUE trace_stop_span(VALUE self, VALUE span, VALUE time) { sky_trace_t* trace; My_Struct(trace, sky_trace_t, consumed_trace_msg); CHECK_NUMERIC(time); CHECK_TYPE(span, T_FIXNUM); if (sky_have_memprof()) { sky_trace_span_add_uint_annotation(trace, FIX2UINT(span), 1, sky_consume_allocations()); } CHECK_FFI( sky_trace_span_done(trace, FIX2UINT(span), NUM2ULL(time)), "native Trace#stop_span failed"); return Qnil; }
static VALUE trace_start_span(VALUE self, VALUE time, VALUE category) { sky_trace_t* trace; uint32_t span; My_Struct(trace, sky_trace_t, consumed_trace_msg); CHECK_NUMERIC(time); CHECK_TYPE(category, T_STRING); CHECK_FFI( sky_trace_instrument(trace, NUM2ULL(time), STR2BUF(category), &span), "native Trace#start_span failed"); if (sky_have_memprof()) { sky_trace_span_add_uint_annotation(trace, span, 2, sky_consume_allocations()); } return UINT2NUM(span); }
gboolean gncEntryEqual(const GncEntry *a, const GncEntry *b) { if (a == NULL && b == NULL) return TRUE; if (a == NULL || b == NULL) return FALSE; g_return_val_if_fail(GNC_IS_ENTRY(a), FALSE); g_return_val_if_fail(GNC_IS_ENTRY(b), FALSE); CHECK_STRING(a, b, desc); CHECK_STRING(a, b, action); CHECK_STRING(a, b, notes); CHECK_NUMERIC(a, b, quantity); if (a->invoice != NULL) { CHECK_ACCOUNT(a, b, i_account); CHECK_NUMERIC(a, b, i_price); CHECK_VALUE(a, b, i_taxable); CHECK_VALUE(a, b, i_taxincluded); if (!gncTaxTableEqual(a->i_tax_table, b->i_tax_table)) { PWARN("i_tax_table differ"); return FALSE; } CHECK_NUMERIC(a, b, i_discount); CHECK_VALUE(a, b, i_disc_type); CHECK_VALUE(a, b, i_disc_how); CHECK_NUMERIC(a, b, i_value); CHECK_NUMERIC(a, b, i_value_rounded); CHECK_NUMERIC(a, b, i_tax_value); CHECK_NUMERIC(a, b, i_tax_value_rounded); CHECK_NUMERIC(a, b, i_disc_value); CHECK_NUMERIC(a, b, i_disc_value_rounded); #if 0 Timespec date; Timespec date_entered; /* employee bill data */ GncEntryPaymentType b_payment; /* customer invoice */ GList * i_tax_values; Timespec i_taxtable_modtime; #endif } if (a->bill != NULL) { CHECK_ACCOUNT(a, b, b_account); CHECK_NUMERIC(a, b, b_price); CHECK_NUMERIC(a, b, b_value); CHECK_NUMERIC(a, b, b_value_rounded); CHECK_NUMERIC(a, b, b_tax_value); CHECK_NUMERIC(a, b, b_tax_value_rounded); #if 0 Timespec date; Timespec date_entered; /* vendor bill data */ gboolean b_taxable; gboolean b_taxincluded; GncTaxTable * b_tax_table; gboolean billable; GncOwner billto; /* employee bill data */ GncEntryPaymentType b_payment; /* vendor bill */ GList * b_tax_values; Timespec b_taxtable_modtime; #endif } /* FIXME: Need real tests */ return TRUE; }