当前位置: 首页>>代码示例>>C#>>正文


C# TimeUnit.ToNanos方法代码示例

本文整理汇总了C#中TimeUnit.ToNanos方法的典型用法代码示例。如果您正苦于以下问题:C# TimeUnit.ToNanos方法的具体用法?C# TimeUnit.ToNanos怎么用?C# TimeUnit.ToNanos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TimeUnit的用法示例。


在下文中一共展示了TimeUnit.ToNanos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScheduledReporter

 /// <summary>
 /// Creates a new <see cref="ScheduledReporter"/> instance
 /// </summary>
 /// <param name="registry">the <see cref="MetricRegistry"/> containing the metrics this reporter will report</param>
 /// <param name="name">the reporter's name</param>
 /// <param name="filter">the filter for which metrics to report</param>
 /// <param name="rateUnit">a unit of time</param>
 /// <param name="durationUnit">a unit of time</param>
 protected ScheduledReporter(MetricRegistry registry,
                             string name,
                             MetricFilter filter,
                             TimeUnit rateUnit,
                             TimeUnit durationUnit)
 {
     this.registry = registry;
     this.filter = filter;
     this.rateFactor = rateUnit.ToSeconds(1);
     this.rateUnit = calculateRateUnit(rateUnit);
     this.durationFactor = 1.0 / durationUnit.ToNanos(1);
     this.durationUnit = durationUnit.ToString().ToLowerInvariant();
 }
开发者ID:thattolleyguy,项目名称:metrics-net,代码行数:21,代码来源:ScheduledReporter.cs

示例2: Update

 public void Update(long duration, TimeUnit unit)
 {
     Update(unit.ToNanos(duration));
 }
开发者ID:johannesg,项目名称:metrics-net,代码行数:4,代码来源:TimerMetricBase.cs

示例3: Rate

 /// <summary>
 /// Returns the rate in the given units of time.
 /// </summary>
 public double Rate(TimeUnit rateUnit)
 {
     var nanos = rateUnit.ToNanos(1);
     return _rate * nanos;
 }
开发者ID:thattolleyguy,项目名称:metrics-net,代码行数:8,代码来源:EWMA.cs

示例4: EWMA

 /// <summary>
 /// Create a new EWMA with a specific smoothing constant.
 /// </summary>
 /// <param name="alpha">The smoothing constant</param>
 /// <param name="interval">The expected tick interval</param>
 /// <param name="intervalUnit">The time unit of the tick interval</param>
 public EWMA(double alpha, long interval, TimeUnit intervalUnit)
 {
     _interval = intervalUnit.ToNanos(interval);
     _alpha = alpha;
 }
开发者ID:thattolleyguy,项目名称:metrics-net,代码行数:11,代码来源:EWMA.cs

示例5: Convert

 public static long Convert(this TimeUnit timeUnit, long d, TimeUnit u)
 {
     switch (timeUnit)
     {
         case TimeUnit.NANOSECONDS:
             return u.ToNanos(d);
         case TimeUnit.MICROSECONDS:
             return u.ToMicros(d);
         case TimeUnit.MILLISECONDS:
             return u.ToMillis(d);
         case TimeUnit.SECONDS:
             return u.ToSeconds(d);
         case TimeUnit.MINUTES:
             return u.ToMinutes(d);
         case TimeUnit.HOURS:
             return u.ToHours(d);
         case TimeUnit.DAYS:
             return u.ToDays(d);
     }
     return d;
 }
开发者ID:yao-yi,项目名称:BoboBrowse.Net,代码行数:21,代码来源:TimeUnit.cs


注:本文中的TimeUnit.ToNanos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。