< prev index next >

src/hotspot/os/linux/os_linux.cpp

Print this page
rev 50967 : 8206977: Minor improvements of runtime code.


2091     bool get_first_line = (strcmp(file, "/etc/SuSE-release") == 0);
2092     parse_os_info_helper(fp, distro, length, get_first_line);
2093     fclose(fp);
2094   }
2095 }
2096 
2097 void os::get_summary_os_info(char* buf, size_t buflen) {
2098   for (int i = 0;; i++) {
2099     const char* file = distro_files[i];
2100     if (file == NULL) {
2101       break; // ran out of distro_files
2102     }
2103     if (file_exists(file)) {
2104       parse_os_info(buf, buflen, file);
2105       return;
2106     }
2107   }
2108   // special case for debian
2109   if (file_exists("/etc/debian_version")) {
2110     strncpy(buf, "Debian ", buflen);

2111     parse_os_info(&buf[7], buflen-7, "/etc/debian_version");

2112   } else {
2113     strncpy(buf, "Linux", buflen);
2114   }
2115 }
2116 
2117 void os::Linux::print_libversion_info(outputStream* st) {
2118   // libc, pthread
2119   st->print("libc:");
2120   st->print("%s ", os::Linux::glibc_version());
2121   st->print("%s ", os::Linux::libpthread_version());
2122   st->cr();
2123 }
2124 
2125 void os::Linux::print_proc_sys_info(outputStream* st) {
2126   st->cr();
2127   st->print_cr("/proc/sys/kernel/threads-max (system-wide limit on the number of threads):");
2128   _print_ascii_file("/proc/sys/kernel/threads-max", st);
2129   st->cr();
2130   st->cr();
2131 


2803 bool os::numa_topology_changed() { return false; }
2804 
2805 size_t os::numa_get_groups_num() {
2806   // Return just the number of nodes in which it's possible to allocate memory
2807   // (in numa terminology, configured nodes).
2808   return Linux::numa_num_configured_nodes();
2809 }
2810 
2811 int os::numa_get_group_id() {
2812   int cpu_id = Linux::sched_getcpu();
2813   if (cpu_id != -1) {
2814     int lgrp_id = Linux::get_node_by_cpu(cpu_id);
2815     if (lgrp_id != -1) {
2816       return lgrp_id;
2817     }
2818   }
2819   return 0;
2820 }
2821 
2822 int os::Linux::get_existing_num_nodes() {
2823   size_t node;
2824   size_t highest_node_number = Linux::numa_max_node();
2825   int num_nodes = 0;
2826 
2827   // Get the total number of nodes in the system including nodes without memory.
2828   for (node = 0; node <= highest_node_number; node++) {
2829     if (isnode_in_existing_nodes(node)) {
2830       num_nodes++;
2831     }
2832   }
2833   return num_nodes;
2834 }
2835 
2836 size_t os::numa_get_leaf_groups(int *ids, size_t size) {
2837   size_t highest_node_number = Linux::numa_max_node();
2838   size_t i = 0;
2839 
2840   // Map all node ids in which is possible to allocate memory. Also nodes are
2841   // not always consecutively available, i.e. available from 0 to the highest
2842   // node number.
2843   for (size_t node = 0; node <= highest_node_number; node++) {
2844     if (Linux::isnode_in_configured_nodes(node)) {
2845       ids[i++] = node;
2846     }
2847   }
2848   return i;
2849 }
2850 
2851 bool os::get_page_info(char *start, page_info* info) {
2852   return false;
2853 }
2854 
2855 char *os::scan_pages(char *start, char* end, page_info* page_expected,
2856                      page_info* page_found) {
2857   return end;
2858 }
2859 
2860 
2861 int os::Linux::sched_getcpu_syscall(void) {
2862   unsigned int cpu = 0;
2863   int retval = -1;
2864 




2091     bool get_first_line = (strcmp(file, "/etc/SuSE-release") == 0);
2092     parse_os_info_helper(fp, distro, length, get_first_line);
2093     fclose(fp);
2094   }
2095 }
2096 
2097 void os::get_summary_os_info(char* buf, size_t buflen) {
2098   for (int i = 0;; i++) {
2099     const char* file = distro_files[i];
2100     if (file == NULL) {
2101       break; // ran out of distro_files
2102     }
2103     if (file_exists(file)) {
2104       parse_os_info(buf, buflen, file);
2105       return;
2106     }
2107   }
2108   // special case for debian
2109   if (file_exists("/etc/debian_version")) {
2110     strncpy(buf, "Debian ", buflen);
2111     if (buflen > 7) {
2112       parse_os_info(&buf[7], buflen-7, "/etc/debian_version");
2113     }
2114   } else {
2115     strncpy(buf, "Linux", buflen);
2116   }
2117 }
2118 
2119 void os::Linux::print_libversion_info(outputStream* st) {
2120   // libc, pthread
2121   st->print("libc:");
2122   st->print("%s ", os::Linux::glibc_version());
2123   st->print("%s ", os::Linux::libpthread_version());
2124   st->cr();
2125 }
2126 
2127 void os::Linux::print_proc_sys_info(outputStream* st) {
2128   st->cr();
2129   st->print_cr("/proc/sys/kernel/threads-max (system-wide limit on the number of threads):");
2130   _print_ascii_file("/proc/sys/kernel/threads-max", st);
2131   st->cr();
2132   st->cr();
2133 


2805 bool os::numa_topology_changed() { return false; }
2806 
2807 size_t os::numa_get_groups_num() {
2808   // Return just the number of nodes in which it's possible to allocate memory
2809   // (in numa terminology, configured nodes).
2810   return Linux::numa_num_configured_nodes();
2811 }
2812 
2813 int os::numa_get_group_id() {
2814   int cpu_id = Linux::sched_getcpu();
2815   if (cpu_id != -1) {
2816     int lgrp_id = Linux::get_node_by_cpu(cpu_id);
2817     if (lgrp_id != -1) {
2818       return lgrp_id;
2819     }
2820   }
2821   return 0;
2822 }
2823 
2824 int os::Linux::get_existing_num_nodes() {
2825   int node;
2826   int highest_node_number = Linux::numa_max_node();
2827   int num_nodes = 0;
2828 
2829   // Get the total number of nodes in the system including nodes without memory.
2830   for (node = 0; node <= highest_node_number; node++) {
2831     if (isnode_in_existing_nodes(node)) {
2832       num_nodes++;
2833     }
2834   }
2835   return num_nodes;
2836 }
2837 
2838 size_t os::numa_get_leaf_groups(int *ids, size_t size) {
2839   int highest_node_number = Linux::numa_max_node();
2840   size_t i = 0;
2841 
2842   // Map all node ids in which it is possible to allocate memory. Also nodes are
2843   // not always consecutively available, i.e. available from 0 to the highest
2844   // node number.
2845   for (int node = 0; node <= highest_node_number; node++) {
2846     if (Linux::isnode_in_configured_nodes((unsigned int)node)) {
2847       ids[i++] = node;
2848     }
2849   }
2850   return i;
2851 }
2852 
2853 bool os::get_page_info(char *start, page_info* info) {
2854   return false;
2855 }
2856 
2857 char *os::scan_pages(char *start, char* end, page_info* page_expected,
2858                      page_info* page_found) {
2859   return end;
2860 }
2861 
2862 
2863 int os::Linux::sched_getcpu_syscall(void) {
2864   unsigned int cpu = 0;
2865   int retval = -1;
2866 


< prev index next >