*.exe~
*.dll
*.dylib
+*.o
bin/*
pkg/*
vendor/src
--- /dev/null
+
+/*
+$ gcc -fPIC -c myscoring.c && gcc -shared -o libmyscoring.so.1.0.1 myscoring.o -lm
+$ ln -rs libmyscoring.so.1.0.1 libmyscoring.so
+*/
+
+#include <math.h>
+#include <assert.h>
+#include <stdio.h>
+
+#define CNT 6
+
+/*
+features :
+-. there is using moving average, but it is not written code at service_provider.cpp
+-. bandwidth is not meaning Mbps
+*/
+
+//network score mmDiscovery/service_provider.cpp
+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))) +
+ (1 / (3.22 * pow(usage, -0.241))) +
+ (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) {
+ 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"));
+ score /= 2;
+ score += renderingScore(getResource("network/rtt"));
+
+ return score;
+}
+
+#define CNT 6
+
+double myscoring2(double (*getResource)(const char *))
+{
+
+ printf("myscoring\n");
+
+ 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 resourceValues[CNT];
+
+ // double someResource;
+ // someResource = getResource("some/usage");
+ // assert(isnan(someResource));
+
+ for (int i = 0; i < CNT; i++)
+ {
+ resourceValues[i] = getResource(resourceNames[i]);
+ printf("resourceNames : %s %f\n", resourceNames[i], resourceValues[i]);
+ }
+
+ score = 0.0;
+ for (int i = 0; i < CNT; i++)
+ {
+ score += resourceValues[i] * W[i];
+ }
+
+ return score;
+}
--- /dev/null
+# Description of service that will be requested
+[Version]
+ConfVersion=v0.0 ; Version of Configuration file
+
+[ServiceInfo]
+ServiceName=ls ; Name of distributed service
+
+[ScoringMethod]
+LibFile=./libmyscoring.so ; Library file name
+FunctionName=myscoring
+
+[ResourceType]
+IntervalTimeMs=1000 ; Interval time of get resource
+MaxCount=10 ; Number of times
+++ /dev/null
-libmyscoring.so.1.0.1
\ No newline at end of file
+++ /dev/null
-
-/*
-$ gcc -fPIC -c myscoring.c && gcc -shared -o libmyscoring.so.1.0.1 myscoring.o -lm
-$ ln -rs libmyscoring.so.1.0.1 libmyscoring.so
-*/
-
-#include <math.h>
-#include <assert.h>
-#include <stdio.h>
-
-#define CNT 6
-
-/*
-features :
--. there is using moving average, but it is not written code at service_provider.cpp
--. bandwidth is not meaning Mbps
-*/
-
-//network score mmDiscovery/service_provider.cpp
-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))) +
- (1 / (3.22 * pow(usage, -0.241))) +
- (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) {
- 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"));
- score /= 2;
- score += renderingScore(getResource("network/rtt"));
-
- return score;
-}
-
-#define CNT 6
-
-double myscoring2(double (*getResource)(const char *))
-{
-
- printf("myscoring\n");
-
- 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 resourceValues[CNT];
-
- // double someResource;
- // someResource = getResource("some/usage");
- // assert(isnan(someResource));
-
- for (int i = 0; i < CNT; i++)
- {
- resourceValues[i] = getResource(resourceNames[i]);
- printf("resourceNames : %s %f\n", resourceNames[i], resourceValues[i]);
- }
-
- score = 0.0;
- for (int i = 0; i < CNT; i++)
- {
- score += resourceValues[i] * W[i];
- }
-
- return score;
-}
+++ /dev/null
-# Description of service that will be requested
-[Version]
-ConfVersion=v0.0 ; Version of Configuration file
-
-[ServiceInfo]
-ServiceName=ls ; Name of distributed service
-
-[ScoringMethod]
-LibFile=./libmyscoring.so ; Library file name
-FunctionName=myscoring
-
-[ResourceType]
-IntervalTimeMs=1000 ; Interval time of get resource
-MaxCount=10 ; Number of times