public void AddMetric(string ns, bool value, params Modifier[] modifiers) { var nativeValue = new NativeValue { v_bool = value ? 1 : 0, vtype = (int)ValueType.TypeBool }; AddMetricWithNativeValue(ns, nativeValue, modifiers); }
public void AddMetric(string ns, string value, params Modifier[] modifiers) { var nativeValue = new NativeValue { v_cstring = Marshal.StringToHGlobalAnsi(value), vtype = (int)ValueType.TypeCString }; AddMetricWithNativeValue(ns, nativeValue, modifiers); }
public void AddMetric(string ns, double value, params Modifier[] modifiers) { var nativeValue = new NativeValue { v_double = value, vtype = (int)ValueType.TypeDouble }; AddMetricWithNativeValue(ns, nativeValue, modifiers); }
public void AddMetric(string ns, uint value, params Modifier[] modifiers) { var nativeValue = new NativeValue { v_uint64 = value, vtype = (int)ValueType.TypeUint64 }; AddMetricWithNativeValue(ns, nativeValue, modifiers); }
private void AddMetricWithNativeValue(string ns, NativeValue nativeValue, params Modifier[] modifiers) { var nativeModifiers = ToNativeModifiers(modifiers); var errPtr = CBridge.ctx_add_metric(TaskId, ns, nativeValue, nativeModifiers); Memory.FreeNativeModifiers(nativeModifiers); if (nativeValue.vtype == (int)ValueType.TypeCString) { Marshal.FreeHGlobal(nativeValue.v_cstring); } Exceptions.ThrowExceptionIfError(errPtr); }
internal static IntPtr /* NativeError */ ctx_add_metric(string taskId, string ns, NativeValue nativeValue, NativeModifiers nativeModifiers) { if (IsWindows()) { return(CBridgeWin.ctx_add_metric(taskId, ns, nativeValue, nativeModifiers)); } if (IsLinux()) { return(CBridgeLinux.ctx_add_metric(taskId, ns, nativeValue, nativeModifiers)); } throw new NotImplementedException(NoImplementedError); }
internal static extern IntPtr /* NativeError */ ctx_add_metric(string taskId, string ns, NativeValue nativeValue, NativeModifiers nativeModifiers);