mock/myscoring : bug 45/203245/1
authorjaehoon.hyun <jaehoon.hyun@samsung.com>
Thu, 11 Apr 2019 05:05:07 +0000 (14:05 +0900)
committerjaehoon.hyun <jaehoon.hyun@samsung.com>
Thu, 11 Apr 2019 05:05:07 +0000 (14:05 +0900)
move to parent directory

Change-Id: I92673e7a675ff631ae2f7df2bb5b9862490bbe2c

.gitignore
src/scoringmgr/mock/myscoring/libmyscoring.so.1.0.1 [new file with mode: 0644]
src/scoringmgr/mock/myscoring/myscoring.c [new file with mode: 0644]
src/scoringmgr/mock/myscoring/myscoring.conf [new file with mode: 0644]
src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so [deleted symlink]
src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so.1.0.1 [deleted file]
src/scoringmgr/mock/myscoring/myscoring/myscoring.c [deleted file]
src/scoringmgr/mock/myscoring/myscoring/myscoring.conf [deleted file]

index 72e72c0af20ecef01cffab2a9ad194b704a7add1..c986ba7db217934bbb45524520346a34d6348597 100644 (file)
@@ -3,6 +3,7 @@
 *.exe~
 *.dll
 *.dylib
+*.o
 bin/*
 pkg/*
 vendor/src
diff --git a/src/scoringmgr/mock/myscoring/libmyscoring.so.1.0.1 b/src/scoringmgr/mock/myscoring/libmyscoring.so.1.0.1
new file mode 100644 (file)
index 0000000..582a2f0
Binary files /dev/null and b/src/scoringmgr/mock/myscoring/libmyscoring.so.1.0.1 differ
diff --git a/src/scoringmgr/mock/myscoring/myscoring.c b/src/scoringmgr/mock/myscoring/myscoring.c
new file mode 100644 (file)
index 0000000..90c4e7a
--- /dev/null
@@ -0,0 +1,83 @@
+
+/*
+$ 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;
+}
diff --git a/src/scoringmgr/mock/myscoring/myscoring.conf b/src/scoringmgr/mock/myscoring/myscoring.conf
new file mode 100644 (file)
index 0000000..9f8ee04
--- /dev/null
@@ -0,0 +1,14 @@
+# 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
diff --git a/src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so b/src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so
deleted file mode 120000 (symlink)
index 50bdf3c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-libmyscoring.so.1.0.1
\ No newline at end of file
diff --git a/src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so.1.0.1 b/src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so.1.0.1
deleted file mode 100755 (executable)
index 582a2f0..0000000
Binary files a/src/scoringmgr/mock/myscoring/myscoring/libmyscoring.so.1.0.1 and /dev/null differ
diff --git a/src/scoringmgr/mock/myscoring/myscoring/myscoring.c b/src/scoringmgr/mock/myscoring/myscoring/myscoring.c
deleted file mode 100644 (file)
index 90c4e7a..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-
-/*
-$ 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;
-}
diff --git a/src/scoringmgr/mock/myscoring/myscoring/myscoring.conf b/src/scoringmgr/mock/myscoring/myscoring/myscoring.conf
deleted file mode 100644 (file)
index 9f8ee04..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# 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