Separate benchmark tool from rpc-port 75/308975/13
authorHwankyu Jhun <h.jhun@samsung.com>
Wed, 3 Apr 2024 07:56:53 +0000 (16:56 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 4 Apr 2024 03:38:10 +0000 (12:38 +0900)
The rpc-port-benchmark package is added.
The tools are moved to the package.
The following servies of systemd are added for socket & dbus activation:
 - rpc-port-benchmark-server-tidl.service
 - rpc-port-benchmark-server-tidl.socket
 - rpc-port-benchmark-server-dbus.service
 - tizen.appfw.rpcport.benchmark.dbus.busname
 - tizen.appfw.rpcport.benchmark.dbus.service
 - rpc-port-benchmark-client-tidl.service
 - rpc-port-benchmark-client-dbus.service

Change-Id: I3d39ef2c6c452069ff0656b967cfe5b70f11a450
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
15 files changed:
benchmark/server/dbus/main.cc
benchmark/server/tidl/main.cc
benchmark/tool/dbus-proxy.cc
benchmark/tool/dbus-proxy.hh
benchmark/tool/main.cc
benchmark/tool/options.cc
benchmark/tool/options.hh
packaging/rpc-port-benchmark-client-dbus.service [new file with mode: 0644]
packaging/rpc-port-benchmark-client-tidl.service [new file with mode: 0644]
packaging/rpc-port-benchmark-server-dbus.service [new file with mode: 0644]
packaging/rpc-port-benchmark-server-tidl.service [new file with mode: 0644]
packaging/rpc-port-benchmark-server-tidl.socket [new file with mode: 0644]
packaging/rpc-port.spec
packaging/tizen.appfw.rpcport.benchmark.dbus.busname [new file with mode: 0644]
packaging/tizen.appfw.rpcport.benchmark.dbus.service [new file with mode: 0644]

index fc2390e..c1be8f7 100644 (file)
@@ -33,7 +33,15 @@ constexpr const char INTROSPECTION_XML[] = R"__dbus(
     <method name='Test'>
       <arg type='s' name='data' direction='in'/>
       <arg type='i' name='ret' direction='out'/>
-      </method>
+    </method>
+    <method name='Start'>
+      <arg type='i' name='caller_pid' direction='in'/>
+      <arg type='i' name='ret' direction='out'/>
+    </method>
+    <method name='Stop'>
+      <arg type='i' name='caller_pid' direction='in'/>
+      <arg type='i' name='ret' direction='out'/>
+    </method>
   </interface>
 </node>
 )__dbus";
@@ -71,6 +79,24 @@ class MainLoop {
 
           GVariant* param = g_variant_new("(i)", ret);
           g_dbus_method_invocation_return_value(invocation, param);
+        } else if (std::string_view(method_name) == "Stop") {
+          gint caller_pid = -1;
+          g_variant_get(parameters, "(i)", &caller_pid);
+          _D("Stop request received from caller(%d)", caller_pid);
+          auto* main_loop = static_cast<MainLoop*>(user_data);
+          int ret = main_loop->SetTermTimer();
+
+          GVariant* param = g_variant_new("(i)", ret);
+          g_dbus_method_invocation_return_value(invocation, param);
+        } else if (std::string_view(method_name) == "Start") {
+          gint caller_pid = -1;
+          g_variant_get(parameters, "(i)", &caller_pid);
+          _D("Start request received from caller(%d)", caller_pid);
+          auto* main_loop = static_cast<MainLoop*>(user_data);
+          int ret = main_loop->UnsetTermTimer();
+
+          GVariant* param = g_variant_new("(i)", ret);
+          g_dbus_method_invocation_return_value(invocation, param);
         }
       },
       nullptr,
@@ -84,7 +110,8 @@ class MainLoop {
         &interface_vtable,
         this, nullptr, &error);
     if (reg_id == 0) {
-      _E("g_dbus_connection_register_object error(%s)", error ? error->message : "");
+      _E("g_dbus_connection_register_object error(%s)",
+          error ? error->message : "");
       g_error_free(error);
     }
   }
@@ -129,9 +156,33 @@ class MainLoop {
     g_main_loop_quit(loop_);
   }
 
+  int SetTermTimer() {
+    if (timer_) return 0;
+
+    timer_ = g_timeout_add(
+        5000, [](gpointer user_data) {
+          auto* main_loop = static_cast<MainLoop*>(user_data);
+          main_loop->Quit();
+          main_loop->timer_ = 0;
+          return G_SOURCE_REMOVE;
+        }, this);
+
+    return 0;
+  }
+
+  int UnsetTermTimer() {
+    if (timer_) {
+      g_source_remove(timer_);
+      timer_ = 0;
+    }
+
+    return 0;
+  }
+
  private:
   GMainLoop* loop_ = nullptr;
   GDBusNodeInfo* introspection_data_ = nullptr;
+  guint timer_ = 0;
 };
 
 }  // namespace
index 7a084f6..803f4d3 100644 (file)
@@ -29,73 +29,109 @@ constexpr const char SERVER_PROC_NAME[] =
 
 namespace bs = rpc_port::BenchmarkStub::stub;
 
+class MainLoop {
+ public:
+  MainLoop();
+  ~MainLoop();
+
+  void Run();
+  void Quit();
+  void SetTermTimer();
+  void RemoveTermTimer();
+
+ private:
+  GMainLoop* loop_;
+  bs::Benchmark stub_;
+  guint timer_ = 0;
+};
+
 class TestService : public bs::Benchmark::ServiceBase {
  public:
   class Factory : public bs::Benchmark::ServiceBase::Factory {
    public:
+    explicit Factory(MainLoop* loop) : loop_(loop) {}
+
     virtual ~Factory() = default;
 
     std::unique_ptr<bs::Benchmark::ServiceBase>
         CreateService(std::string sender, std::string instance) {
       return std::unique_ptr<bs::Benchmark::ServiceBase>(
-          new TestService(std::move(sender), std::move(instance)));
+          new TestService(std::move(sender), std::move(instance), loop_));
     }
+
+   private:
+    MainLoop* loop_ = nullptr;
   };
 
-  TestService(std::string sender, std::string instance) :
-      bs::Benchmark::ServiceBase(std::move(sender), std::move(instance)) {}
+  TestService(std::string sender, std::string instance, MainLoop* loop)
+      : bs::Benchmark::ServiceBase(std::move(sender), std::move(instance)),
+        loop_(loop) {}
 
   virtual ~TestService() = default;
 
   void OnCreate() override {
+    loop_->RemoveTermTimer();
   }
 
   void OnTerminate() override {
+    loop_->SetTermTimer();
   }
 
-  int Test(std::string data) override {
-    return 0;
-  }
+  int Test(std::string data) override { return 0; }
+
+ private:
+  MainLoop* loop_ = nullptr;
 };
 
-class MainLoop {
- public:
-  MainLoop() {
-    loop_ = g_main_loop_new(nullptr, FALSE);
+MainLoop::MainLoop() { loop_ = g_main_loop_new(nullptr, FALSE); }
+
+MainLoop::~MainLoop() {
+  RemoveTermTimer();
+  g_main_loop_unref(loop_);
+}
+
+void MainLoop::Run() {
+  std::string proc_name = std::string(SERVER_PROC_NAME);
+  if (getuid() >= 5000) proc_name = "u" + proc_name;
+
+  int ret = rpc_port_register_proc_info(proc_name.c_str(), nullptr);
+  if (ret != RPC_PORT_ERROR_NONE) {
+    _E("rpc_port_register_proc_info() failed (%d)", ret);
+    return;
   }
 
-  ~MainLoop() {
-    g_main_loop_unref(loop_);
+  try {
+    stub_.Listen(std::shared_ptr<bs::Benchmark::ServiceBase::Factory>(
+        new TestService::Factory(this)));
+  } catch (const bs::Exception&) {
+    _E("stub listen is failed");
   }
 
-  void Run() {
-    std::string proc_name = std::string(SERVER_PROC_NAME);
-    if (getuid() >= 5000) proc_name = "u" + proc_name;
+  g_main_loop_run(loop_);
+}
 
-    int ret = rpc_port_register_proc_info(proc_name.c_str(), nullptr);
-    if (ret != RPC_PORT_ERROR_NONE) {
-      _E("rpc_port_register_proc_info() failed (%d)", ret);
-      return;
-    }
+void MainLoop::Quit() { g_main_loop_quit(loop_); }
 
-    try {
-      stub_.Listen(std::shared_ptr<bs::Benchmark::ServiceBase::Factory>(
-          new TestService::Factory()));
-    } catch (const bs::Exception&) {
-      _E("stub listen is failed");
-    }
+void MainLoop::SetTermTimer() {
+  if (timer_) return;
 
-    g_main_loop_run(loop_);
-  }
+  timer_ = g_timeout_add(
+      5000,
+      [](gpointer data) -> gboolean {
+        auto* main_loop = static_cast<MainLoop*>(data);
+        main_loop->Quit();
+        main_loop->timer_ = 0;
+        return G_SOURCE_REMOVE;
+      },
+      this);
+}
 
-  void Quit() {
-    g_main_loop_quit(loop_);
+void MainLoop::RemoveTermTimer() {
+  if (timer_) {
+    g_source_remove(timer_);
+    timer_ = 0;
   }
-
- private:
-  GMainLoop* loop_;
-  bs::Benchmark stub_;
-};
+}
 
 }  // namespace
 
index 82f5b23..94cd878 100644 (file)
@@ -44,9 +44,22 @@ void DbusProxy::Connect() {
   }
 }
 
-int DbusProxy::Test(std::string data) const {
-  auto* msg = g_dbus_message_new_method_call(BUS_NAME,
-        OBJECT_PATH, INTERFACE_NAME, "Test");
+int DbusProxy::Test(std::string data) {
+  return MethodCall("Test", g_variant_new("(s)", data.c_str()));
+}
+
+int DbusProxy::Start(pid_t caller_pid) {
+  return MethodCall("Start", g_variant_new("(i)", caller_pid));
+}
+
+int DbusProxy::Stop(pid_t caller_pid) {
+  return MethodCall("Stop", g_variant_new("(i)", caller_pid));
+}
+
+int DbusProxy::MethodCall(const std::string_view method_name,
+                          GVariant* parameters) {
+  auto* msg = g_dbus_message_new_method_call(
+      BUS_NAME, OBJECT_PATH, INTERFACE_NAME, method_name.data());
   if (msg == nullptr) {
     _E("g_dbus_message_new_method_call() is failed");
     return -1;
@@ -54,13 +67,14 @@ int DbusProxy::Test(std::string data) const {
   std::unique_ptr<GDBusMessage, decltype(g_object_unref)*> msg_auto(
       msg, g_object_unref);
 
-  g_dbus_message_set_body(msg, g_variant_new("(s)", data.c_str()));
+  g_dbus_message_set_body(msg, parameters);
   GError* error = nullptr;
-  auto* reply = g_dbus_connection_send_message_with_reply_sync(system_conn_, msg,
-      G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, nullptr, nullptr, &error);
+  auto* reply = g_dbus_connection_send_message_with_reply_sync(
+      system_conn_, msg, G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, nullptr, nullptr,
+      &error);
   if (reply == nullptr || error != nullptr) {
     _E("g_dbus_connection_send_message_with_reply_sync() is failed. error(%s)",
-        error ? error->message : "Unknown");
+       error ? error->message : "Unknown");
     g_clear_error(&error);
     return -1;
   }
index 7c5f4c4..7e0c8a6 100644 (file)
 #ifndef DBUS_PROXY_HH_
 #define DBUS_PROXY_HH_
 
-#include <string>
-#include <memory>
-
 #include <gio/gio.h>
 #include <glib.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <memory>
+#include <string>
+#include <string_view>
 
 namespace rpc_port {
 namespace benchmark {
@@ -31,7 +34,13 @@ class DbusProxy {
   DbusProxy();
 
   void Connect();
-  int Test(std::string data) const;
+  int Test(std::string data);
+  int Start(pid_t caller_pid);
+  int Stop(pid_t caller_pid);
+
+ private:
+  int MethodCall(const std::string_view method_name,
+                 GVariant* parameters);
 
  private:
   GDBusConnection* system_conn_ = nullptr;
index b9bece1..a7b037a 100644 (file)
 #include <unistd.h>
 
 #include <chrono>
+#include <ctime>
+#include <fstream>
 #include <iostream>
+#include <sstream>
+#include <string>
 
-#include "log-private.hh"
-#include "options.hh"
 #include "BenchmarkProxy.h"
 #include "dbus-proxy.hh"
 #include "grpc-proxy.hh"
+#include "log-private.hh"
+#include "options.hh"
 
 namespace {
 
@@ -73,6 +77,8 @@ class Tester {
       return;
     }
 
+    if (options_->ShouldPrintTime()) PrintStartTime();
+
     ExecuteServer();
     if (options_->IsDbus()) {
       dbus_proxy_.Connect();
@@ -127,6 +133,8 @@ class Tester {
     bool is_dbus = options_->IsDbus();
     bool is_grpc = options_->IsGrpc();
 
+    if (is_dbus) dbus_proxy_.Start(getpid());
+
     StartTime();
     for (int i = 0; i < iters; i++) {
       if (is_func) {
@@ -166,6 +174,8 @@ class Tester {
       }
     }
     EndTime(iters, size);
+
+    if (is_dbus) dbus_proxy_.Stop(getpid());
   }
 
   int FakeFunction(std::string str) {
@@ -189,6 +199,7 @@ class Tester {
   void ExecuteServer() {
     bool is_dbus = options_->IsDbus();
     bool is_grpc = options_->IsGrpc();
+    if (!is_grpc) return;
 
     server_pid_ = fork();
     if (server_pid_ == 0) {
@@ -220,6 +231,43 @@ class Tester {
     }
   }
 
+  void PrintStartTime() {
+    std::ifstream stat_file("/proc/self/stat");
+    if (!stat_file) {
+      _E("Failed to open stat");
+      return;
+    }
+
+    std::string line;
+    getline(stat_file, line);
+    std::istringstream iss(line);
+
+    std::string value;
+    int pos = 21;
+    for (int i = 0; i < pos; ++i) iss >> value;
+
+    iss >> value;
+    stat_file.close();
+
+    long start_time = std::stol(value) / sysconf(_SC_CLK_TCK);
+    time_t start_time_seconds = start_time;
+    long start_time_microseconds = (start_time - start_time_seconds) * 1000000;
+
+    std::time_t start_time_utc = std::time(nullptr) - start_time_seconds;
+    std::tm* start_time_tm = std::localtime(&start_time_utc);
+
+    char buffer[26];
+    std::strftime(buffer, sizeof(buffer), "%Y-%m %H:%M:%S", start_time_tm);
+
+    std::string result = buffer;
+    result += ".";
+    result += std::to_string(start_time_microseconds);
+    result += " UTC";
+
+    std::cout << "Program start time: [" << value << "] " << result
+              << std::endl;
+  }
+
  private:
   std::unique_ptr<rpc_port::benchmark::Options> options_;
   std::unique_ptr<bp::Benchmark> proxy_;
index 894947a..b45385e 100644 (file)
@@ -34,12 +34,13 @@ Help Options:
   -h, --help                  Show help options
 
 Additional Options:
-  -f, --funcation                     Use function call instead of RPC
+  -f, --funcion                     Use function call instead of RPC
   -d, --dbus                          Use Dbus method instead of TIDL RPC
   -g, --grpc                          Use gRPC over UDS instead of TIDL RPC
   -a, --all                           Test pre-defined test-cases
   -i, --interations=<Iterations>      Iterations
   -s, --size=<Data size>              Data size (byte)
+  -t, --time                          Print starting time of this tool
 
 Application Options:
   -v, --version               Show version information
@@ -73,11 +74,12 @@ std::unique_ptr<Options> Options::Parse(int argc, char** argv) {
     {"dbus", no_argument, nullptr, 'd'},
     {"grpc", no_argument, nullptr, 'g'},
     {"all", no_argument, nullptr, 'a'},
+    {"time", no_argument, nullptr, 't'},
     {0, 0, 0, 0}
   };
 
   while (true) {
-    int c = getopt_long(argc, argv, "vhfdgai:s:", long_options,
+    int c = getopt_long(argc, argv, "vhfdgati:s:", long_options,
         &option_index);
     if (c == -1)
       break;
@@ -124,6 +126,11 @@ std::unique_ptr<Options> Options::Parse(int argc, char** argv) {
         options->is_all_ = true;
         break;
 
+      case 't':
+        opt[OPT_TIME] = true,
+        options->should_print_time_ = true;
+        break;
+
       default:
         cmd[CMD_HELP] = true;
     }
index fefef21..71e357a 100644 (file)
@@ -54,6 +54,10 @@ class Options {
     return is_grpc_;
   }
 
+  bool ShouldPrintTime() const {
+    return should_print_time_;
+  }
+
  private:
   enum Cmd {
     CMD_VERSION,
@@ -68,6 +72,7 @@ class Options {
     OPT_FUNCTION,
     OPT_DBUS,
     OPT_GRPC,
+    OPT_TIME,
     OPT_MAX
   };
 
@@ -83,6 +88,7 @@ class Options {
   bool is_all_ = false;
   bool is_dbus_ = false;
   bool is_grpc_ = false;
+  bool should_print_time_ = false;
 };
 
 }  // namespace benchmark
diff --git a/packaging/rpc-port-benchmark-client-dbus.service b/packaging/rpc-port-benchmark-client-dbus.service
new file mode 100644 (file)
index 0000000..274ee12
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=RPC-Port Benchmark Client (DBus)
+
+[Service]
+SmackProcessLabel=System
+ExecStart=/bin/sh -l -c '/usr/bin/rpc-port-benchmark-tool -d -a -t > /tmp/rpc-port-benchmark-tool-dbus.log'
+
+[Install]
+WantedBy=sysinit.target
diff --git a/packaging/rpc-port-benchmark-client-tidl.service b/packaging/rpc-port-benchmark-client-tidl.service
new file mode 100644 (file)
index 0000000..b98c863
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=RPC-Port Benchmark Client (TIDL)
+After=rpc-port-benchmark-server-tidl.socket
+Requires=rpc-port-benchmark-server-tidl.socket
+
+[Service]
+SmackProcessLabel=System
+ExecStart=/bin/sh -l -c '/usr/bin/rpc-port-benchmark-tool -a -t > /tmp/rpc-port-benchmark-tool-tidl.log'
+
+[Install]
+WantedBy=sysinit.target
diff --git a/packaging/rpc-port-benchmark-server-dbus.service b/packaging/rpc-port-benchmark-server-dbus.service
new file mode 100644 (file)
index 0000000..3cb6920
--- /dev/null
@@ -0,0 +1,11 @@
+[Unit]
+Description=RPC-Port Benchmark Server (DBus)
+
+[Service]
+BusName=tizen.appfw.rpcport.benchmark.dbus
+Type=dbus
+SmackProcessLabel=System
+ExecStart=/usr/bin/rpc-port-benchmark-server-dbus
+
+[Install]
+WantedBy=sysinit.target
\ No newline at end of file
diff --git a/packaging/rpc-port-benchmark-server-tidl.service b/packaging/rpc-port-benchmark-server-tidl.service
new file mode 100644 (file)
index 0000000..69063a3
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=RPC-Port Benchmark Server (TIDL)
+After=rpc-port-benchmark-server-tidl.socket
+Requires=rpc-port-benchmark-server-tidl.socket
+
+[Service]
+User=app_fw
+Group=app_fw
+SmackProcessLabel=System
+ExecStart=/usr/bin/rpc-port-benchmark-server-tidl
+
+[Install]
+WantedBy=sysinit.target
\ No newline at end of file
diff --git a/packaging/rpc-port-benchmark-server-tidl.socket b/packaging/rpc-port-benchmark-server-tidl.socket
new file mode 100644 (file)
index 0000000..b13eee9
--- /dev/null
@@ -0,0 +1,13 @@
+[Unit]
+Description=RPC Port Benchmark Server (TIDL)
+DefaultDependencies=no
+Before=sockets.target
+
+[Socket]
+ListenStream=/run/aul/rpcport/.d::org.tizen.appfw.rpc_port.benchmark::Benchmark
+SocketMode=0666
+SmackLabelIPIn=*
+SmackLabelIPOut=@
+
+[Install]
+WantedBy=sockets.target
\ No newline at end of file
index f1c1cfe..f904fa6 100644 (file)
@@ -5,7 +5,14 @@ Release:    0
 Group:         Application Framework/Libraries
 License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
-Source1001:    %{name}.manifest
+Source1001: %{name}.manifest
+Source1002: rpc-port-benchmark-server-dbus.service
+Source1003: rpc-port-benchmark-server-tidl.service
+Source1004: rpc-port-benchmark-server-tidl.socket
+Source1005: tizen.appfw.rpcport.benchmark.dbus.busname
+Source1006: tizen.appfw.rpcport.benchmark.dbus.service
+Source1007: rpc-port-benchmark-client-dbus.service
+Source1008: rpc-port-benchmark-client-tidl.service
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(aul)
 BuildRequires:  pkgconfig(bundle)
@@ -68,9 +75,24 @@ Group:      Application Framework/Testing
 RPC Port gcov objects
 %endif
 
+%package benchmark
+Summary:    Benchmark tool for rpc-port
+Group:      Application Framework/Testing
+Requires:   %{name}
+
+%description benchmark
+Benchmark tool for rpc-port
+
 %prep
 %setup -q
 cp %{SOURCE1001} .
+cp %{SOURCE1002} .
+cp %{SOURCE1003} .
+cp %{SOURCE1004} .
+cp %{SOURCE1005} .
+cp %{SOURCE1006} .
+cp %{SOURCE1007} .
+cp %{SOURCE1008} .
 
 %build
 %if 0%{?gcov:1}
@@ -99,6 +121,28 @@ rm -rf %{buildroot}
 
 %make_install
 
+mkdir -p %{buildroot}%{_unitdir}
+install -m 0644 %{SOURCE1002} %{buildroot}%{_unitdir}/rpc-port-benchmark-server-dbus.service
+install -m 0644 %{SOURCE1003} %{buildroot}%{_unitdir}/rpc-port-benchmark-server-tidl.service
+
+mkdir -p %{buildroot}%{_unitdir}/sockets.target.wants
+install -m 0644 %{SOURCE1004} %{buildroot}%{_unitdir}/rpc-port-benchmark-server-tidl.socket
+ln -sf ../rpc-port-benchmark-server-tidl.socket %{buildroot}%{_unitdir}/sockets.target.wants/rpc-port-benchmark-server-tidl.socket
+
+mkdir -p %{buildroot}%{_unitdir}/busnames.target.wants
+install -m 0644 %{SOURCE1005} %{buildroot}%{_unitdir}/tizen.appfw.rpcport.benchmark.dbus.busname
+ln -sf ../tizen.appfw.rpcport.benchmark.dbus.busname %{buildroot}%{_unitdir}/busnames.target.wants/tizen.appfw.rpcport.benchmark.dbus.busname
+
+mkdir -p %{buildroot}%{_datadir}/dbus-1/system-services
+install -m 0644 %{SOURCE1006} %{buildroot}%{_datadir}/dbus-1/system-services/tizen.appfw.rpcport.benchmark.dbus.service
+
+mkdir -p %{buildroot}%{_unitdir}/sysinit.target.wants
+install -m 0644 %{SOURCE1007} %{buildroot}%{_unitdir}/rpc-port-benchmark-client-dbus.service
+ln -sf ../rpc-port-benchmark-client-dbus.service %{buildroot}%{_unitdir}/sysinit.target.wants/rpc-port-benchmark-client-dbus.service
+
+install -m 0644 %{SOURCE1008} %{buildroot}%{_unitdir}/rpc-port-benchmark-client-tidl.service
+ln -sf ../rpc-port-benchmark-client-tidl.service %{buildroot}%{_unitdir}/sysinit.target.wants/rpc-port-benchmark-client-tidl.service
+
 %if 0%{?gcov:1}
 builddir=$(basename $PWD)
 gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir"
@@ -155,14 +199,9 @@ install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
 
 %files
 %manifest %{name}.manifest
-%config %{_sysconfdir}/dbus-1/system.d/rpc-port-benchmark.conf
 %attr(0644,root,root) %{_libdir}/lib%{name}.so.*
 %license LICENSE.APLv2
 %{_bindir}/rpc-port-util
-%{_bindir}/rpc-port-benchmark-server-tidl
-%{_bindir}/rpc-port-benchmark-server-dbus
-%{_bindir}/rpc-port-benchmark-server-grpc
-%{_bindir}/rpc-port-benchmark-tool
 %config %{_sysconfdir}/dbus-1/system.d/rpc-port.conf
 
 %files devel
@@ -184,3 +223,22 @@ install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/
 %files gcov
 %{_datadir}/gcov/*
 %endif
+
+%files benchmark
+%manifest %{name}.manifest
+%config %{_sysconfdir}/dbus-1/system.d/rpc-port-benchmark.conf
+%{_bindir}/rpc-port-benchmark-server-tidl
+%{_bindir}/rpc-port-benchmark-server-dbus
+%{_bindir}/rpc-port-benchmark-server-grpc
+%{_bindir}/rpc-port-benchmark-tool
+%attr(0644,root,root) %{_unitdir}/rpc-port-benchmark-server-tidl.service
+%attr(0644,root,root) %{_unitdir}/rpc-port-benchmark-server-tidl.socket
+%attr(0644,root,root) %{_unitdir}/sockets.target.wants/rpc-port-benchmark-server-tidl.socket
+%attr(0644,root,root) %{_unitdir}/rpc-port-benchmark-server-dbus.service
+%attr(0644,root,root) %{_unitdir}/tizen.appfw.rpcport.benchmark.dbus.busname
+%attr(0644,root,root) %{_unitdir}/busnames.target.wants/tizen.appfw.rpcport.benchmark.dbus.busname
+%attr(0644,root,root) %{_datadir}/dbus-1/system-services/tizen.appfw.rpcport.benchmark.dbus.service
+%attr(0644,root,root) %{_unitdir}/rpc-port-benchmark-client-tidl.service
+%attr(0644,root,root) %{_unitdir}/sysinit.target.wants/rpc-port-benchmark-client-tidl.service
+%attr(0644,root,root) %{_unitdir}/rpc-port-benchmark-client-dbus.service
+%attr(0644,root,root) %{_unitdir}/sysinit.target.wants/rpc-port-benchmark-client-dbus.service
diff --git a/packaging/tizen.appfw.rpcport.benchmark.dbus.busname b/packaging/tizen.appfw.rpcport.benchmark.dbus.busname
new file mode 100644 (file)
index 0000000..6bd34ff
--- /dev/null
@@ -0,0 +1,9 @@
+[Unit]
+Description=DBUS1:tizen.appfw.rpcport.benchmark.dbus
+Documentation=man:systemd
+DefaultDependencies=no
+
+[BusName]
+Name=tizen.appfw.rpcport.benchmark.dbus
+Service=rpc-port-benchmark-server-dbus.service
+AllowWorld=talk
\ No newline at end of file
diff --git a/packaging/tizen.appfw.rpcport.benchmark.dbus.service b/packaging/tizen.appfw.rpcport.benchmark.dbus.service
new file mode 100644 (file)
index 0000000..acf4711
--- /dev/null
@@ -0,0 +1,4 @@
+[D-BUS Service]
+Name=tizen.appfw.rpcport.benchmark.dbus
+Exec=/bin/false
+SystemdService=rpc-port-benchmark-server-dbus.service
\ No newline at end of file