+++ /dev/null
-/*******************************************************************************
- * Copyright 2019 Samsung Electronics All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *******************************************************************************/
-/*
-$ gcc -fPIC -c myscoring.c && gcc -shared -o libmyscoring.so.1.0.1 myscoring.o
-$ 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
-/*******************************************************************************
- * Copyright 2019 Samsung Electronics All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *******************************************************************************/
-
-/*
-$ gcc -fPIC -c mysum.c && gcc -shared -o libmysum.so.1.0.1 mysum.o
-$ ln -rs libmysum.so.1.0.1 libmysum.so
-*/
-
-int add(int a, int b)
-{
- return a + b;
-}
\ No newline at end of file
+++ /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=./libmysum.so ; Library file name
-FunctionName=add
-
-[ResourceType]
-IntervalTimeMs=1000 ; Interval time of get resource
-MaxCount=10 ; Number of times
+++ /dev/null
-/*******************************************************************************
- * Copyright 2019 Samsung Electronics All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- *******************************************************************************/
-
-/*
-$ gcc -fPIC -c myscoring.c && gcc -shared -o libmyscoring.so.1.0.1 myscoring.o
-$ ln -rs libmyscoring.so.1.0.1 libmyscoring.so
-*/
-
-#include <assert.h>
-#include <math.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
-libmysum.so.1.0.1
\ No newline at end of file
+++ /dev/null
-/*******************************************************************************
- * Copyright 2019 Samsung Electronics All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language sgoverning permissions and
- * limitations under the License.
- *
- *******************************************************************************/
-
-/*
-$ gcc -fPIC -c mysum.c && gcc -shared -o libmysum.so.1.0.1 mysum.o
-$ ln -rs libmysum.so.1.0.1 libmysum.so
-*/
-
-int add(int a, int b) { return a + b; }
\ No newline at end of file
+++ /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=./libmysum.so ; Library file name
-FunctionName=add
-
-[ResourceType]
-IntervalTimeMs=1000 ; Interval time of get resource
-MaxCount=10 ; Number of times