Changeset 11252


Ignore:
Timestamp:
07/31/14 16:37:29 (8 years ago)
Author:
mroscoe
Message:
 
Location:
branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/App_Code/ChartHelper.cshtml

    r11246 r11252  
    478478  var @(destinationTag)PlotOptions = {
    479479    title: "@title",
     480    highlighter: {
     481      show: true,
     482      sizeAdjust: 7.5
     483    },
    480484    axes: {
    481485      xaxis: {
     
    502506          @:max: window["@(dataName)Data" + 0][window["@(dataName)Data" + 0].length - 1][1] + upperYBuffer,
    503507        }
    504         numberTicks: 6
     508        numberTicks: 5
    505509      }
    506510    },
     
    510514        show: false
    511515      }
     516    },
     517    cursor: {
     518      show: true,
     519      showTooltip: false,
     520      zoom: true,
     521      clickReset: false,
     522      dblClickReset: false,
     523      constrainZoomTo: 'x'
    512524    }
    513525  };
     
    836848            '<button class="collapse" onclick="CollapseSection(this)">-</button>' +
    837849            '<div id="UserTask@(taskState)Plot" class="noXTicks"></div>' +
     850            '<label id="UserTask@(taskState)PlotInfo"></label>' +
    838851          '</section>'
    839852        );
    840853      }
    841854      var userTasks = [];
     855      var userNameLabels = [];
    842856      var userNames = [];
    843857      for (i=0; i < result.length; i++) {
    844858        userTasks[i] = [result[i].Value];
    845         userNames[i] = { label: result[i].Key };
     859        userNameLabels[i] = { label: result[i].Key };
     860        userNames[i] = result[i].Key;
    846861      }
    847862      window["UserTask@(taskState)Plot"] = $.jqplot("UserTask@(taskState)Plot", userTasks, {
     
    852867          pointLabels: {show: true, formatString: '%.3f'}
    853868        },
    854         series: userNames,
     869        series: userNameLabels,
    855870        legend: {
    856871          show: true,
     
    872887        }
    873888      });
     889      /* Bind a datalistener to each chart and display details of clicked
     890        upon data in the label below the chart */
     891      $("#UserTask" + "@(taskState)Plot").bind('jqplotDataClick', function (ev, seriesIndex, pointIndex, data) {
     892        $(this).next("label").html(userNames[seriesIndex] + " Tasks @(taskState): "  + data[1]);
     893      });
    874894    }});
    875895  </text>
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Content/Site.css

    r11246 r11252  
    555555}
    556556
     557label[id^="UserTask"][id$="PlotInfo"] {
     558  margin-top: 2%;
     559  padding-left: 2%;
     560}
     561
    557562/* User Page Styles*/
    558563#TasksContainer div[id^="Task"] {
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Controllers/ChartDataController.cs

    r11246 r11252  
    9292    }
    9393
     94    public JsonResult CurrentCpuUtilization()
     95    {
     96      using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString))
     97      {
     98        var currentCpuUtil = (from client in db.FactClientInfos
     99                             join clients in db.DimClients
     100                               on client.ClientId equals clients.Id
     101                             where clients.ExpirationTime == null
     102                             select new { client.ClientId, client.CpuUtilization, client.Time })
     103                             .OrderBy(c => c.Time).GroupBy(c => c.ClientId).ToList();
     104
     105        List<double> result = new List<double>();
     106        result.Add(Math.Round(currentCpuUtil.Average(s => s.Last().CpuUtilization), 2));
     107
     108        return Json(result, JsonRequestBehavior.AllowGet);
     109      }
     110    }
     111
    94112    public JsonResult CurrentCores()
    95113    {
     
    97115      {
    98116        var currentCores = (from client in db.FactClientInfos
    99                             select new { client.NumTotalCores, client.NumUsedCores })
    100                             .ToList();
     117                            join clients in db.DimClients
     118                              on client.ClientId equals clients.Id
     119                            where clients.ExpirationTime == null
     120                            select new { client.ClientId, client.NumTotalCores, client.NumUsedCores, client.Time })
     121                            .OrderBy(c => c.Time).GroupBy(c => c.ClientId).ToList();
    101122
    102123        List<int> result = new List<int>();
    103         result.Add(currentCores.Sum(c => c.NumTotalCores));
    104         result.Add(currentCores.Sum(s => s.NumUsedCores));
     124        result.Add(currentCores.Sum(c => c.Last().NumTotalCores));
     125        result.Add(currentCores.Sum(s => s.Last().NumUsedCores));
    105126
    106127        return Json(result, JsonRequestBehavior.AllowGet);
     
    108129    }
    109130
    110     public JsonResult CurrentCpuUtilization()
    111     {
    112       using (var db = new HiveDataContext(Settings.Default.HeuristicLab_Hive_LinqConnectionString))
    113       {
    114         var currentCpuUtil = (from client in db.FactClientInfos
    115                             select new { client.CpuUtilization })
    116                             .ToList();
    117 
    118         List<double> result = new List<double>();
    119         result.Add(Math.Round(currentCpuUtil.Average(s => s.CpuUtilization), 2));
    120 
    121         return Json(result, JsonRequestBehavior.AllowGet);
    122       }
    123     }
    124 
    125131    public JsonResult CurrentMemory()
    126132    {
     
    128134      {
    129135        var currentMemory = (from client in db.FactClientInfos
    130                             select new { client.TotalMemory, client.UsedMemory })
    131                             .ToList();
     136                            join clients in db.DimClients
     137                              on client.ClientId equals clients.Id
     138                            where clients.ExpirationTime == null
     139                            select new { client.ClientId, client.TotalMemory, client.UsedMemory, client.Time })
     140                            .OrderBy(c => c.Time).GroupBy(c => c.ClientId).ToList();
    132141
    133142        List<int> result = new List<int>();
    134         result.Add(currentMemory.Sum(c => c.TotalMemory)/1000);
    135         result.Add(currentMemory.Sum(s => s.UsedMemory)/1000);
     143        result.Add(currentMemory.Sum(c => c.Last().TotalMemory)/1000);
     144        result.Add(currentMemory.Sum(s => s.Last().UsedMemory)/1000);
    136145
    137146        return Json(result, JsonRequestBehavior.AllowGet);
  • branches/HiveStatistics/sources/HeuristicLab.Services.Hive.Statistics/3.3/Views/Home/Index.cshtml

    r11246 r11252  
    104104        RefreshCharts();
    105105      });
    106 
    107       @ChartHelper.UserTasks(Url.Action("UserTasks", "ChartData"), "section.currentStats", "Calculating");
    108       @ChartHelper.UserTasks(Url.Action("UserTasks", "ChartData"), "section.currentStats", "Waiting");
    109106    });
    110107
     
    119116
    120117    $(document).ready(function () {
    121       @ChartHelper.SetStreamingProperties(1000,20,10)
     118      @ChartHelper.UserTasks(Url.Action("UserTasks", "ChartData"), "section.currentStats", "Calculating");
     119      @ChartHelper.UserTasks(Url.Action("UserTasks", "ChartData"), "section.currentStats", "Waiting");
     120
     121      @ChartHelper.SetStreamingProperties(1000,20,5)
    122122
    123123      @ChartHelper.CreateStreamChart("CurrentCPU", "CurrentCPUUtilization",Url.Action("CurrentCpuUtilization","ChartData"),"Current CPU Utilization","%.2f%%",100.00)
Note: See TracChangeset for help on using the changeset viewer.