Ejemplo n.º 1
0
        private static void FillTimes(RubyStruct /*!*/ result)
        {
            var process = Process.GetCurrentProcess();

            RubyStructOps.TmsSetUserTime(result, process.UserProcessorTime.TotalSeconds);
            RubyStructOps.TmsSetSystemTime(result, process.PrivilegedProcessorTime.TotalSeconds);
            RubyStructOps.TmsSetChildUserTime(result, 0.0);
            RubyStructOps.TmsSetChildSystemTime(result, 0.0);
        }
Ejemplo n.º 2
0
        public static RubyStruct /*!*/ GetTimes(RubyModule /*!*/ self)
        {
            var result = RubyStruct.Create(RubyStructOps.GetTmsClass(self.Context));

            try {
                FillTimes(result);
            } catch (SecurityException) {
                RubyStructOps.TmsSetUserTime(result, 0.0);
                RubyStructOps.TmsSetSystemTime(result, 0.0);
                RubyStructOps.TmsSetChildUserTime(result, 0.0);
                RubyStructOps.TmsSetChildSystemTime(result, 0.0);
            }

            return(result);
        }