Skip to content

Commit

Permalink
change get_time_now_us function
Browse files Browse the repository at this point in the history
  • Loading branch information
muriloAvlis committed Jun 11, 2024
1 parent c03fdc8 commit 1268ac5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ Add a paragraph about the application here...

## Requirements

- python3-dev;
- libsctp-dev;
- ninja-build;
- swig v4.1 or newer;
[//]: # (- python3-dev;)
[//]: # (- libsctp-dev;)
[//]: # (- ninja-build;)
[//]: # (- swig v4.1 or newer;)

- Ubuntu Server 24.04 LTS;
- FlexRIC (available in: https://gitlab.eurecom.fr/mosaic5g/flexric)

## Getting Started

Expand All @@ -22,14 +25,14 @@ git clone --recurse-submodules -j8 [email protected]:gercom-ufpa/iqos-xapp.git
Copy service models libraries to system.

```shell
cd iqos-xapp
sudo mkdir -p /usr/local/etc/
sudo cp -R libs/serviceModels /usr/local/lib/flexric
```

Build the xApp.

```shell
cd iqos-xapp
mkdir -p build && cd build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DE2AP_VERSION=E2AP_V3 -DKPM_VERSION=KPM_V3_00 ..
ninja xapp_iqos
Expand Down
1 change: 1 addition & 0 deletions include/kpmManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "chrono"
#include <cassert>
#include <iostream>
#include <cstdlib>

namespace KpmManager
{
Expand Down
13 changes: 7 additions & 6 deletions src/kpmManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ namespace KpmManager

u_int64_t get_time_now_us()
{
auto now{std::chrono::high_resolution_clock::now()};
auto duration{std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch())};
return duration.count();
auto now = std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::system_clock::now().time_since_epoch()
);
return now.count();
}

// callback to handle return data from KPM subscription
Expand All @@ -319,16 +320,16 @@ namespace KpmManager
kpm_ind_msg_format_3_t const* msg_frm_3{&ind->msg.frm_3}; // ind message

static int counter = 1;
const u_int64_t now{get_time_now_us()};

// create a new scope
{
pthread_mutex_lock(&mtx);
defer(pthread_mutex_unlock(&mtx));

// print latency xApp <-> E2 Node
printf("\n <--------------KPM ind_msg %d | latency = %ld [μs] --------------> \n", counter,
now - hdr_frm_1->collectStartTime); // xApp <-> E2 Node
u_int64_t latency{get_time_now_us() - hdr_frm_1->collectStartTime};
printf("\n <--------------KPM ind_msg %d | latency = %lu [μs] --------------> \n", counter,
latency); // xApp <-> E2 Node

// SPDLOG_DEBUG("KPM ind_msg latency = {:d} [μs]",);

Expand Down

0 comments on commit 1268ac5

Please sign in to comment.