# Modeling Network-Controlled Device-to-Device Communications in SimuLTE
## 6 Performance Evaluation
### Profiling  
The purpose of this section is to assess the computational overhead of D2D communications in SimuLTE. More specifically, we want to show that adding D2D communications increases the simulation time only marginally with respect to classical infrastructure-based communications. We profile the execution time of SimuLTE, analyzing how the latter is influenced by the number of UEs and the system packet rate. Moreover, we verify the impact of the D2D implementation on the execution time, by executing three variants of the same scenario, where several UEs send each other packets using, respectively, infrastructure communication (henceforth referred to as Infra), or D2D one-to-one communications, with and without dynamic transmission format selection (referred to as D2D and D2D-Fixed, respectively). The scenario consists of a single cell, where D2D endpoints are close to each other and to the eNB, so that all CQIs on the UL, DL, and SL are equal to 15. Each D2D pair supports a unidirectional flow, with a constant inter-packet time and packets of fixed size throughout the whole simulation. eNB scheduling is done without frequency reuse. The above scenario is run for 100 s of simulated time, five times in independent conditions. We perform our experiments on a Kubuntu 16.04 machine equipped with an Intel(R) Core(TM) i7 CPU at 3.60 GHz, with 16 GB of RAM. Execution times are measured using the _time_ Unix command on batch and command-line only simulations, i.e., without any graphical user interface. In Figure 16, we compare the execution time in the three configurations, varying the number of UE pairs, while maintaining the inter-packet time at 0.1 s. First, we can see that the execution time grows almost linearly with the number of UE-pairs. Second, the Infra configurations are faster than the D2D one, but slower than the D2D-fixed. On the one hand, in the D2D configuration CQIs for both the UL and the SL must be computed, which requires twice as many channel computations as the Infra and D2D-Fixed configurations. On the other hand, infrastructure-based communications require two MAC-layer transmission (i.e., in the UL and the DL legs) to get a packet to destination, whereas D2D ones take a single hop, which reduces the number of MAC-layer computations. The above explanation is confirmed by the breakdown of the execution times, which can be obtained by running a simulation through _valgrind_ ([[http://valgrind.org](http://valgrind.org)]([http://valgrind.org](http://valgrind.org))) (measurements are obtained using _callgrind_, one of valgrind's tools, which counts the number of CPU cycles spent within each function) and observing the time spent performing each high-level function. One such breakdown is shown in Figure 17. While absolute times are not comparable to those of Figure 16, since using valgrind slows down the simulation considerably, the figure shows that the Infra configuration spends more CPU cycles than the other two running the MAC at the eNB (because of the two-hop communication), whereas the _D2D_ configurations spends more time computing and storing SL CQIs. In the previous experiment, we used a fixed inter-packet time of 0.1 s. Therefore, the overall number of packets per second in the simulation increased with the number of UEs. In Figure 18, we show the results obtained fixing the number of UE pairs to 30, and reducing the inter-packet from 0.3 to 0.06 s, thus obtaining a cell-wise packet rate from 100 to 500 pps (In the last configuration, ~20% of the LTE system spectrum is allocated on average, corresponding to a medium load). As we can see, this leads to a small increase in the execution time, and the same relationships among the three scenarios are still observable.