hotspot/src/os/solaris/vm/os_solaris.cpp
changeset 1374 4c24294029a9
parent 391 f889070a8684
child 1388 3677f5f3d66b
equal deleted inserted replaced
615:570062d730b2 1374:4c24294029a9
  1689 
  1689 
  1690     return true;
  1690     return true;
  1691   }
  1691   }
  1692 }
  1692 }
  1693 
  1693 
       
  1694 bool os::supports_vtime() { return true; }
       
  1695 
       
  1696 bool os::enable_vtime() {
       
  1697   int fd = open("/proc/self/ctl", O_WRONLY);
       
  1698   if (fd == -1)
       
  1699     return false;
       
  1700 
       
  1701   long cmd[] = { PCSET, PR_MSACCT };
       
  1702   int res = write(fd, cmd, sizeof(long) * 2);
       
  1703   close(fd);
       
  1704   if (res != sizeof(long) * 2)
       
  1705     return false;
       
  1706 
       
  1707   return true;
       
  1708 }
       
  1709 
       
  1710 bool os::vtime_enabled() {
       
  1711   int fd = open("/proc/self/status", O_RDONLY);
       
  1712   if (fd == -1)
       
  1713     return false;
       
  1714 
       
  1715   pstatus_t status;
       
  1716   int res = read(fd, (void*) &status, sizeof(pstatus_t));
       
  1717   close(fd);
       
  1718   if (res != sizeof(pstatus_t))
       
  1719     return false;
       
  1720 
       
  1721   return status.pr_flags & PR_MSACCT;
       
  1722 }
       
  1723 
       
  1724 double os::elapsedVTime() {
       
  1725   return (double)gethrvtime() / (double)hrtime_hz;
       
  1726 }
       
  1727 
  1694 // Used internally for comparisons only
  1728 // Used internally for comparisons only
  1695 // getTimeMillis guaranteed to not move backwards on Solaris
  1729 // getTimeMillis guaranteed to not move backwards on Solaris
  1696 jlong getTimeMillis() {
  1730 jlong getTimeMillis() {
  1697   jlong nanotime = getTimeNanos();
  1731   jlong nanotime = getTimeNanos();
  1698   return (jlong)(nanotime / NANOSECS_PER_MILLISECS);
  1732   return (jlong)(nanotime / NANOSECS_PER_MILLISECS);
  2659      cur++;
  2693      cur++;
  2660    }
  2694    }
  2661    return bottom;
  2695    return bottom;
  2662 }
  2696 }
  2663 
  2697 
  2664 // Detect the topology change. Typically happens during CPU pluggin-unplugging.
  2698 // Detect the topology change. Typically happens during CPU plugging-unplugging.
  2665 bool os::numa_topology_changed() {
  2699 bool os::numa_topology_changed() {
  2666   int is_stale = Solaris::lgrp_cookie_stale(Solaris::lgrp_cookie());
  2700   int is_stale = Solaris::lgrp_cookie_stale(Solaris::lgrp_cookie());
  2667   if (is_stale != -1 && is_stale) {
  2701   if (is_stale != -1 && is_stale) {
  2668     Solaris::lgrp_fini(Solaris::lgrp_cookie());
  2702     Solaris::lgrp_fini(Solaris::lgrp_cookie());
  2669     Solaris::lgrp_cookie_t c = Solaris::lgrp_init(Solaris::LGRP_VIEW_CALLER);
  2703     Solaris::lgrp_cookie_t c = Solaris::lgrp_init(Solaris::LGRP_VIEW_CALLER);