< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page
rev 52333 : imported patch 8213058


5941   assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno));
5942   return st.st_mtim;
5943 }
5944 
5945 int os::compare_file_modified_times(const char* file1, const char* file2) {
5946   struct timespec filetime1 = get_mtime(file1);
5947   struct timespec filetime2 = get_mtime(file2);
5948   int diff = filetime1.tv_sec - filetime2.tv_sec;
5949   if (diff == 0) {
5950     return filetime1.tv_nsec - filetime2.tv_nsec;
5951   }
5952   return diff;
5953 }
5954 
5955 /////////////// Unit tests ///////////////
5956 
5957 #ifndef PRODUCT
5958 
5959 #define test_log(...)              \
5960   do {                             \
5961     if (VerboseInternalVMTests) {  \
5962       tty->print_cr(__VA_ARGS__);  \
5963       tty->flush();                \
5964     }                              \
5965   } while (false)
5966 
5967 class TestReserveMemorySpecial : AllStatic {
5968  public:
5969   static void small_page_write(void* addr, size_t size) {
5970     size_t page_size = os::vm_page_size();
5971 
5972     char* end = (char*)addr + size;
5973     for (char* p = (char*)addr; p < end; p += page_size) {
5974       *p = 1;
5975     }
5976   }
5977 
5978   static void test_reserve_memory_special_huge_tlbfs_only(size_t size) {
5979     if (!UseHugeTLBFS) {
5980       return;
5981     }
5982 
5983     test_log("test_reserve_memory_special_huge_tlbfs_only(" SIZE_FORMAT ")", size);
5984 




5941   assert(ret == 0, "failed to stat() file '%s': %s", filename, strerror(errno));
5942   return st.st_mtim;
5943 }
5944 
5945 int os::compare_file_modified_times(const char* file1, const char* file2) {
5946   struct timespec filetime1 = get_mtime(file1);
5947   struct timespec filetime2 = get_mtime(file2);
5948   int diff = filetime1.tv_sec - filetime2.tv_sec;
5949   if (diff == 0) {
5950     return filetime1.tv_nsec - filetime2.tv_nsec;
5951   }
5952   return diff;
5953 }
5954 
5955 /////////////// Unit tests ///////////////
5956 
5957 #ifndef PRODUCT
5958 
5959 #define test_log(...)              \
5960   do {                             \




5961   } while (false)
5962 
5963 class TestReserveMemorySpecial : AllStatic {
5964  public:
5965   static void small_page_write(void* addr, size_t size) {
5966     size_t page_size = os::vm_page_size();
5967 
5968     char* end = (char*)addr + size;
5969     for (char* p = (char*)addr; p < end; p += page_size) {
5970       *p = 1;
5971     }
5972   }
5973 
5974   static void test_reserve_memory_special_huge_tlbfs_only(size_t size) {
5975     if (!UseHugeTLBFS) {
5976       return;
5977     }
5978 
5979     test_log("test_reserve_memory_special_huge_tlbfs_only(" SIZE_FORMAT ")", size);
5980 


< prev index next >