*/
//network score mmDiscovery/service_provider.cpp
-static double networkScore(double n) {
+static double networkScore(double n)
+{
return 1 / (8770 * pow(n, -0.9));
}
//cpu score mmDiscovery/service_provider.cpp
-static double cpuScore(double freq, double usage, double count){
- return ((1 / (5.66 * pow(freq, -0.66))) +
+static double cpuScore(double freq, double usage, double count)
+{
+ return ((1 / (5.66 * pow(freq, -0.66))) +
(1 / (3.22 * pow(usage, -0.241))) +
- (1 / (4 * pow(count, -0.3)))) / 3;
+ (1 / (4 * pow(count, -0.3)))) /
+ 3;
}
//render score mmDiscovery/service_provider.cpp
//https://github.com/Samsung/Castanets/blob/castanets_63/service_discovery_manager/Component/mmDiscovery/monitor_client.cpp
-static double renderingScore(double r) {
+static double renderingScore(double r)
+{
return (r < 0) ? 0 : 0.77 * pow(r, -0.43);
}
//============== INTERFACE API ==============
double myscoring(double (*getResource)(const char *))
{
-
+
printf("myscoring\n");
double score;
-
-
+
score = 0.0;
score += networkScore(getResource("network/bandwidth"));
score += cpuScore(getResource("cpu/freq"), getResource("cpu/usage"), getResource("cpu/count"));
double score;
const char *resourceNames[CNT] = {"cpu/usage", "cpu/count", "memory/free", "memory/available", "network/mbps", "network/bandwidth"};
- double W[CNT] = {1.48271, 4.125421, 5.3381723, 9.194717234, 2.323, 1.123};
+ double W[CNT] = {1.48271, 4.125421, 5.3381723, 9.194717234, 2.323, 1.123};
double resourceValues[CNT];
// double someResource;
double myscoring3(double (*getResource)(const char *))
{
- printf("myscoring\n");
+ // printf("myscoring\n");
double score;
const char *resourceNames[MY_SCORING_3_CNT] = {"cpu/usage", "cpu/count", "memory/free", "memory/available"};
- double W[MY_SCORING_3_CNT] = {1.48271, 4.125421, 5.3381723, 9.194717234};
+ double W[MY_SCORING_3_CNT] = {1.48271, 4.125421, 5.3381723, 9.194717234};
double resourceValues[MY_SCORING_3_CNT];
// double someResource;
for (int i = 0; i < MY_SCORING_3_CNT; i++)
{
resourceValues[i] = getResource(resourceNames[i]);
- printf("resourceNames : %s %f\n", resourceNames[i], resourceValues[i]);
+ // printf("resourceNames : %s %f\n", resourceNames[i], resourceValues[i]);
}
score = 0.0;