Module | Analytics::ResourceUsage |
In: |
lib/graph_controller_extensions/resource_usage_analytics.rb
|
This method is used to get the data for percentage cpu usage for a specific application from the ResourceUsage model. This data is supplied to the line graph method to plot the line graph.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 104 104: def get_cpu_utilization 105: app_id = params[:id] 106: start_time, end_time = get_time_range(params[:time_slab]) 107: wall_time, cpu_usage, max, slab, step = ::ResourceUsage.get_application_data(app_id, start_time, end_time, "cpu") 108: line_graph(wall_time, cpu_usage, CPU_USGAE_GRAPH_TITLE, max, slab, step, "Wall Time", "% CPU Usage") 109: end
This method is used to get the data for memory usage for a specific application from the ResourceUsage model. This data is supplied to the line graph method to plot the line graph.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 125 125: def get_memory_utilization 126: app_id = params[:id] 127: start_time, end_time = get_time_range(params[:time_slab]) 128: wall_time, memory_usage, max, slab, step = ::ResourceUsage.get_application_data(app_id, start_time, end_time, "memory") 129: line_graph(wall_time, memory_usage, MEMORY_USAGE_GRAPH_TITLE, max, slab, step, "Wall Time", "Memory (in MB)") 130: end
This method renders the partial containing resource usage Graphs for an application.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 83 83: def get_resource_usage_data_app(app_id) 84: @app_id = app_id 85: check_and_set_query_date 86: @app_cpu_usage_graph, @app_memory_usage_graph = get_resource_usage_graph_app(@app_id) 87: render :partial => 'resource_usage_graph_app' 88: end
This method is to populate the varriable app_cpu_usage_graph and app_memory_usage_graph with the respective graphs data. app_cpu_usage_graph contains the data for Percentage CPU usage by a specfic application. app_memory_usage_graph contains the data for Memory usage by a specfic application.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 75 75: def get_resource_usage_graph_app(app_id) 76: @start_hour, @end_hour, start_time, end_time = get_start_and_end_time_from_session() 77: app_cpu_usage_graph = plot_graph("graph/get_cpu_utilization/#{app_id}?time_slab=#{start_time}.#{end_time}", 'cpu_utilization')#Graph depicts the cpu utilization 78: app_memory_usage_graph = plot_graph("graph/get_memory_utilization/#{app_id}?time_slab=#{start_time}.#{end_time}", 'memory_utilization')#Graph depicts the memory utilization 79: return app_cpu_usage_graph, app_memory_usage_graph 80: end
This method is to populate the varriable server_cpu_usage_graph and server_memory_usage_graph with the respective graphs data. server_cpu_usage_graph contains the data for server Percentage CPU usage. server_memory_usage_graph contains the data for server Memory usage.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 27 27: def get_resource_usage_graph_server() 28: @start_hour, @end_hour, start_time, end_time = get_start_and_end_time_from_session() 29: server_cpu_usage_graph = plot_graph("graph/get_server_cpu_usage?time_slab=#{start_time}.#{end_time}", 'server_cpu_usage') # Graph is depicting the server Cpu Utilization vs wall time 30: server_memory_usage_graph = plot_graph("graph/get_server_memory_usage?time_slab=#{start_time}.#{end_time}", 'server_memory_usage') # Graph is depicting the server Memory Utilization vs wall time 31: return server_cpu_usage_graph, server_memory_usage_graph 32: end
This method is used to get the data for server percentage cpu usage from the ResourceUsage model. This data is supplied to the line graph method to plot the line graph.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 47 47: def get_server_cpu_usage 48: start_time, end_time = get_time_range(params[:time_slab]) 49: wall_time, cpu_usage, max, slab, step = ::ResourceUsage.get_server_resource_usage(start_time,end_time, "CPU") 50: line_graph(wall_time, cpu_usage, CPU_USGAE_GRAPH_TITLE, max, slab, step, "Wall Time", "% CPU Usage") 51: end
This method is called for getting the server percentage cpu usage graph for a specific date and time.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 35 35: def get_server_cpu_usage_graph 36: time_array = get_start_end_time(params[:date], params[:start_time], params[:end_time]) 37: if time_array.size>1 38: @server_cpu_usage_graph = plot_graph("graph/get_server_cpu_usage?time_slab=#{time_array[0]}.#{time_array[1]}", 'server_cpu_usage') 39: render :text => @server_cpu_usage_graph 40: else 41: render :text => time_array[0] 42: end 43: end
This method is used to get the data for server memory usage from the ResourceUsage model. This data is supplied to the line graph method to plot the line graph.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 65 65: def get_server_memory_usage 66: start_time, end_time = get_time_range(params[:time_slab]) 67: wall_time, memory_usage, max, slab, step = ::ResourceUsage.get_server_resource_usage(start_time, end_time, "Memory") 68: line_graph(wall_time, memory_usage, MEMORY_USAGE_GRAPH_TITLE, max, slab, step, "Wall Time", "Memory (In MB)") 69: end
This method is called for getting the server memory usage graph for a specific date and time.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 54 54: def get_server_memory_usage_graph 55: time_array = get_start_end_time(params[:date], params[:start_time], params[:end_time]) 56: if time_array.size > 1 57: @server_memory_usage_graph = plot_graph("graph/get_server_memory_usage?time_slab=#{time_array[0]}.#{time_array[1]}", 'server_memory_usage') 58: render :text => @server_memory_usage_graph 59: else 60: render :text => time_array[0] 61: end 62: end
This method is called for getting the an applications memory usage graph for a specific date and time.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 112 112: def memory_usage_graph 113: app_id = params[:app_id] 114: time_array = get_start_end_time(params[:date], params[:start_time], params[:end_time]) 115: if time_array.size > 1 116: app_memory_usage_graph = plot_graph("graph/get_memory_utilization/#{app_id}?time_slab=#{time_array[0]}.#{time_array[1]}", 'memory_utilization') 117: render :text => app_memory_usage_graph 118: else 119: render :text => time_array[0] 120: end 121: end
This method is called for getting the an applications percentage cpu usage graph for a specific date and time.
# File lib/graph_controller_extensions/resource_usage_analytics.rb, line 91 91: def percentage_cpu_usage_graph 92: app_id = params[:app_id] 93: time_array = get_start_end_time(params[:date], params[:start_time], params[:end_time]) 94: if time_array.size>1 95: app_cpu_usage_graph = plot_graph("graph/get_cpu_utilization/#{app_id}?time_slab=#{time_array[0]}.#{time_array[1]}", 'cpu_utilization') 96: render :text => app_cpu_usage_graph 97: else 98: render :text => time_array[0] 99: end 100: end