Skip to content

Commit

Permalink
Added SystemLoadAverage to Cloud page
Browse files Browse the repository at this point in the history
  • Loading branch information
cypof committed Apr 16, 2013
1 parent 4972792 commit fcc57f0
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 45 deletions.
78 changes: 39 additions & 39 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
Expand Down Expand Up @@ -152,7 +152,7 @@ org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.comment.line_length=100
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
Expand All @@ -161,7 +161,7 @@ org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=true
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
Expand All @@ -188,13 +188,13 @@ org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_ini
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
Expand Down Expand Up @@ -237,18 +237,18 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_alloc
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
Expand All @@ -268,18 +268,18 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allo
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
Expand Down Expand Up @@ -324,18 +324,18 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_refe
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
Expand All @@ -356,20 +356,20 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
org.eclipse.jdt.core.formatter.lineSplit=200
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=120
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_on_off_tags=true
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
2 changes: 1 addition & 1 deletion .settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Jan
formatter_profile=_0xdata
formatter_settings_version=12
org.eclipse.jdt.ui.ignorelowercasenames=true
org.eclipse.jdt.ui.importorder=java;javax;org;com;
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function build_jar() {

function junit() {
echo "running JUnit tests..."
"$JAVA" -cp ${JAR_FILE} water.Boot -mainClass water.JUnitRunner
"$JAVA" -ea -cp ${JAR_FILE} water.Boot -mainClass water.JUnitRunner
}

clean
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/H2O.java
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ public Cleaner() {
static boolean lazyPersist(){ // free disk > our DRAM?
return H2O.SELF._heartbeat.get_free_disk() > MemoryManager.MEM_MAX;
}
static boolean isDiskFull(){ // free disk space < 5 megs?
static boolean isDiskFull(){ // free disk space < 5K?
File f = new File(PersistIce.ROOT);
return f.getUsableSpace() < (5 << 10);
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/water/HeartBeat.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public class HeartBeat extends Iced {
public long _jvm_boot_msec; // Boot time of JVM
public byte[] _jar_md5; // JAR file digest
public char _num_cpus; // Number of CPUs for this Node, limit of 65535
public float _system_load_average;

// Scaled by K or by M setters & getters.
private int _free_mem; // Free memory in K (goes up and down with GC)
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/water/HeartBeatThread.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package water;

import java.io.File;
import java.lang.management.ManagementFactory;

import javax.management.*;

/**
* Starts a thread publishing multicast HeartBeats to the local subnet: the
Expand Down Expand Up @@ -44,6 +47,13 @@ public HeartBeatThread() {
// with the membership Heartbeat, they will start a round of Paxos group
// discovery.
public void run() {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName os;
try {
os = new ObjectName("java.lang:type=OperatingSystem");
} catch( MalformedObjectNameException ex ) {
throw new RuntimeException(ex);
}
Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
while( true ) {
// Once per second, for the entire cloud a Node will multi-cast publish
Expand All @@ -63,6 +73,13 @@ public void run() {
hb._keys = (H2O.STORE.size ());
hb.set_valsz (myHisto.histo(false)._cached);
hb._num_cpus = (char)run.availableProcessors();
Object load = null;
try {
load = mbs.getAttribute(os, "SystemLoadAverage");
} catch( Exception e ) {
// Ignore, data probably not available on this VM
}
hb._system_load_average = load instanceof Double ? ((Double) load).floatValue() : 0;
int rpcs = 0;
for( H2ONode h2o : cloud._memary )
rpcs += h2o.taskSize();
Expand Down
1 change: 1 addition & 0 deletions src/main/java/water/api/Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public Cloud() {
node.addProperty(FREE_DISK, hb.get_free_disk());
node.addProperty(MAX_DISK, hb.get_max_disk());
node.addProperty(NUM_CPUS, (int)hb._num_cpus);
node.addProperty(SYSTEM_LOAD, hb._system_load_average);

JsonArray fjt = new JsonArray();
JsonArray fjq = new JsonArray();
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/water/api/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public static class Extensions {
public static final String DEPTH = "depth";
public static final String DESCRIPTION = "description";
public static final String DEST_KEY = "destination_key";
public static final String PROGRESS_KEY = "progress_key";
public static final String DTHRESHOLDS = "thresholds";
public static final String END_TIME = "end_time";
public static final String ENUM_DOMAIN_SIZE = "enum_domain_size";
public static final String EPSILON = "epsilon";
public static final String ERROR = "error";
Expand Down Expand Up @@ -110,6 +110,7 @@ public static class Extensions {
public static final String PATH = "path";
public static final String PREVIOUS_MODEL_KEY = "previous_model_key";
public static final String PROGRESS = "progress";
public static final String PROGRESS_KEY = "progress_key";
public static final String PROGRESS_TOTAL = "progress_total";
public static final String REDIRECT = "redirect_request";
public static final String REDIRECT_ARGS = "redirect_request_args";
Expand All @@ -131,12 +132,12 @@ public static class Extensions {
public static final String SOURCE_KEY = "source_key";
public static final String STACK_TRACES = "stack_traces";
public static final String START_TIME = "start_time";
public static final String END_TIME = "end_time";
public static final String STATUS = "status";
public static final String STEP = "step";
public static final String STAT_TYPE = "stat_type";
public static final String STRATA_SAMPLES = "strata_samples";
public static final String SUCCEEDED = "succeeded";
public static final String SYSTEM_LOAD = "system_load";
public static final String TASK_KEY = "task_key";
public static final String TCPS_ACTIVE = "tcps_active";
public static final String TIME = "time";
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/water/api/RequestServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class RequestServer extends NanoHTTPD {
//Request.addToNavbar(registerRequest(new Plot()), "Basic", "Plot");

Request.addToNavbar(registerRequest(new Jobs()), "Jobs", "Admin");
Request.addToNavbar(registerRequest(new Cloud()), "Cloud Status", "Admin");
Request.addToNavbar(registerRequest(new Cloud()), "Cluster Status","Admin");
Request.addToNavbar(registerRequest(new Timeline()), "Timeline", "Admin");
Request.addToNavbar(registerRequest(new JStack()), "Stack Dump", "Admin");
Request.addToNavbar(registerRequest(new Debug()), "Debug Dump", "Admin");
Expand Down

0 comments on commit fcc57f0

Please sign in to comment.