mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly
For automated changes based on OAI PL v1.1:
perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml
The rest (cmake, files with missing license, cmake) manually.
48 lines
1.2 KiB
C
48 lines
1.2 KiB
C
/*
|
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
*/
|
|
|
|
#ifndef _COMMON_UTIL_TIME_STAT_H_
|
|
#define _COMMON_UTIL_TIME_STAT_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
typedef struct {
|
|
uint64_t time; /* unit: microsecond */
|
|
uint64_t value; /* unit: microsecond */
|
|
} time_value_t;
|
|
|
|
typedef struct {
|
|
int head;
|
|
int tail;
|
|
time_value_t *buffer;
|
|
int maxsize;
|
|
int size;
|
|
} time_ring_t;
|
|
|
|
typedef struct {
|
|
int duration; /* unit: microsecond */
|
|
time_ring_t r;
|
|
uint64_t accumulated_value;
|
|
} time_average_t;
|
|
|
|
/* 'duration' is in unit microsecond */
|
|
time_average_t *time_average_new(int duration, int initial_size);
|
|
void time_average_free(time_average_t *t);
|
|
void time_average_reset(time_average_t *t);
|
|
|
|
/* add a value tagged with time 'time' unit microsecond (it also modifies 't',
|
|
* removing all data with time < 'time' - t->duration)
|
|
*/
|
|
void time_average_add(time_average_t *t, uint64_t time, uint64_t value);
|
|
|
|
/* get the average for time 'time' (it also modifies 't', removing all
|
|
* data with time < 'time' - t->duration)
|
|
*/
|
|
double time_average_get_average(time_average_t *t, uint64_t time);
|
|
|
|
/* unit microsecond */
|
|
uint64_t time_average_now(void);
|
|
|
|
#endif /* _COMMON_UTIL_TIME_STAT_H_ */
|