jnr.posix.POSIX.times()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中jnr.posix.POSIX.times()方法的一些代码示例,展示了POSIX.times()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.times()方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:times

POSIX.times介绍

暂无

代码示例

代码示例来源:origin: com.github.jnr/jnr-posix

  1. public Times times() {
  2. try { return posix.times(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
  3. }

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

  1. public Times times() {
  2. return posix().times();
  3. }

代码示例来源:origin: com.github.jnr/jnr-posix

  1. public Times times() {
  2. return posix().times();
  3. }

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver

  1. public Times times() {
  2. try { return posix.times(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
  3. }

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

  1. public Times times() {
  2. try { return posix.times(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
  3. }

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

  1. public Times times() {
  2. try { return posix.times(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
  3. }

代码示例来源:origin: io.prestosql.cassandra/cassandra-driver

  1. public Times times() {
  2. return posix().times();
  3. }

代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep

  1. public Times times() {
  2. return posix().times();
  3. }

代码示例来源:origin: org.python/jython

  1. @Hide(posixImpl = PosixImpl.JAVA)
  2. public static PyTuple times() {
  3. Times times = posix.times();
  4. long CLK_TCK = Sysconf._SC_CLK_TCK.longValue();
  5. return new PyTuple(
  6. ratio(times.utime(), CLK_TCK),
  7. ratio(times.stime(), CLK_TCK),
  8. ratio(times.cutime(), CLK_TCK),
  9. ratio(times.cstime(), CLK_TCK),
  10. ratio(ManagementFactory.getRuntimeMXBean().getUptime(), 1000)
  11. );
  12. }

代码示例来源:origin: org.jruby/jruby-complete

  1. public static IRubyObject times(Ruby runtime) {
  2. Times tms = runtime.getPosix().times();
  3. double utime = 0.0d, stime = 0.0d, cutime = 0.0d, cstime = 0.0d;
  4. if (tms == null) {
  5. ThreadMXBean bean = ManagementFactory.getThreadMXBean();
  6. if(bean.isCurrentThreadCpuTimeSupported()) {
  7. cutime = utime = bean.getCurrentThreadUserTime();
  8. cstime = stime = bean.getCurrentThreadCpuTime() - bean.getCurrentThreadUserTime();
  9. }
  10. } else {
  11. utime = (double)tms.utime();
  12. stime = (double)tms.stime();
  13. cutime = (double)tms.cutime();
  14. cstime = (double)tms.cstime();
  15. }
  16. long hz = runtime.getPosix().sysconf(Sysconf._SC_CLK_TCK);
  17. if (hz == -1) {
  18. hz = 60; //https://github.com/ruby/ruby/blob/trunk/process.c#L6616
  19. }
  20. return RubyStruct.newStruct(runtime.getTmsStruct(),
  21. new IRubyObject[] {
  22. runtime.newFloat(utime / (double) hz),
  23. runtime.newFloat(stime / (double) hz),
  24. runtime.newFloat(cutime / (double) hz),
  25. runtime.newFloat(cstime / (double) hz)
  26. },
  27. Block.NULL_BLOCK);
  28. }

代码示例来源:origin: org.jruby/jruby-core

  1. public static IRubyObject times(Ruby runtime) {
  2. Times tms = runtime.getPosix().times();
  3. double utime = 0.0d, stime = 0.0d, cutime = 0.0d, cstime = 0.0d;
  4. if (tms == null) {
  5. ThreadMXBean bean = ManagementFactory.getThreadMXBean();
  6. if(bean.isCurrentThreadCpuTimeSupported()) {
  7. cutime = utime = bean.getCurrentThreadUserTime();
  8. cstime = stime = bean.getCurrentThreadCpuTime() - bean.getCurrentThreadUserTime();
  9. }
  10. } else {
  11. utime = (double)tms.utime();
  12. stime = (double)tms.stime();
  13. cutime = (double)tms.cutime();
  14. cstime = (double)tms.cstime();
  15. }
  16. long hz = runtime.getPosix().sysconf(Sysconf._SC_CLK_TCK);
  17. if (hz == -1) {
  18. hz = 60; //https://github.com/ruby/ruby/blob/trunk/process.c#L6616
  19. }
  20. return RubyStruct.newStruct(runtime.getTmsStruct(),
  21. new IRubyObject[] {
  22. runtime.newFloat(utime / (double) hz),
  23. runtime.newFloat(stime / (double) hz),
  24. runtime.newFloat(cutime / (double) hz),
  25. runtime.newFloat(cstime / (double) hz)
  26. },
  27. Block.NULL_BLOCK);
  28. }

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

  1. public static IRubyObject times(Ruby runtime) {
  2. Times tms = runtime.getPosix().times();
  3. if (tms == null) {
  4. throw runtime.newErrnoFromLastPOSIXErrno();
  5. }
  6. long hz = runtime.getPosix().sysconf(Sysconf._SC_CLK_TCK);
  7. if (hz == -1) {
  8. throw runtime.newErrnoFromLastPOSIXErrno();
  9. }
  10. return RubyStruct.newStruct(runtime.getTmsStruct(),
  11. new IRubyObject[] {
  12. runtime.newFloat((double) tms.utime() / (double) hz),
  13. runtime.newFloat((double) tms.stime() / (double) hz),
  14. runtime.newFloat((double) tms.cutime() / (double) hz),
  15. runtime.newFloat((double) tms.cstime() / (double) hz)
  16. },
  17. Block.NULL_BLOCK);
  18. }

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

  1. public static IRubyObject times(Ruby runtime) {
  2. Times tms = runtime.getPosix().times();
  3. if (tms == null) {
  4. throw runtime.newErrnoFromLastPOSIXErrno();
  5. }
  6. long hz = runtime.getPosix().sysconf(Sysconf._SC_CLK_TCK);
  7. if (hz == -1) {
  8. throw runtime.newErrnoFromLastPOSIXErrno();
  9. }
  10. return RubyStruct.newStruct(runtime.getTmsStruct(),
  11. new IRubyObject[] {
  12. runtime.newFloat((double) tms.utime() / (double) hz),
  13. runtime.newFloat((double) tms.stime() / (double) hz),
  14. runtime.newFloat((double) tms.cutime() / (double) hz),
  15. runtime.newFloat((double) tms.cstime() / (double) hz)
  16. },
  17. Block.NULL_BLOCK);
  18. }

相关文章

POSIX类方法