osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-dev/+/40839?usp=email )
Change subject: gen_makefile: add --targets
......................................................................
gen_makefile: add --targets
Add an option to specify the targets to include in the Makefile, instead
of always including all of them. This option will be used by testenv to
check early if there are any unknown targets, and to make running the
generated Makefile faster.
Running the Makefile is currently slowed down when having a lot of
projects cloned in osmo-dev's src dir, because regardless of the target
to be built, make is looking for all source files for all projects while
parsing the Makefile. For each project we have:
libosmocore_configure_files := $(shell find -L …/src/libosmocore …)
libosmocore_files := $(shell find -L …/src/libosmocore …)
Changing ":=" to "=" doesn't make it faster either, make still executes
the find commands while parsing target lines such as:
.make.libosmocore.build: .make.libosmocore.configure $(libosmocore_files)
Related: osmo-ttcn3-hacks Ib2d8802b305f145d27aab3c1cc3129709b93d93d
Change-Id: I89bb60e94dd03606dbba5a3609d5e1a95993af5b
---
M gen_makefile.py
M tests/test_gen_makefile.py
2 files changed, 51 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-dev refs/changes/39/40839/1
diff --git a/gen_makefile.py b/gen_makefile.py
index 5eb28ef..4730c59 100755
--- a/gen_makefile.py
+++ b/gen_makefile.py
@@ -153,6 +153,9 @@
parser.add_argument('-A', '--autoreconf-in-src-copy', action='store_true',
help="run autoreconf in a copy of the source dir, avoids 'run make distclean' errors")
+parser.add_argument('--targets',
+ help="comma separated list of high-level targets to build instead of all targets")
+
args = parser.parse_args()
class listdict(dict):
@@ -215,6 +218,40 @@
ret += f"{short}: {' '.join(full)}\n"
return ret
+def filter_projects_deps_targets():
+ if not args.targets:
+ return projects_deps
+
+ ret = {}
+ for target in args.targets.split(","):
+ # .make.osmocom-bb.clone -> osmocom-bb
+ if target.startswith(".make."):
+ target = target.split(".")[2]
+
+ current_targets = [target]
+ if target in convenience_targets:
+ current_targets = convenience_targets[target]
+
+ for target in current_targets:
+ # Add target + all dependencies to ret
+ queue = [target]
+ while queue:
+ project = queue.pop()
+ if project not in projects_deps:
+ print()
+ print(f"ERROR: filter_projects_deps_targets: can't find project {project} in projects_deps!")
+ print()
+ sys.exit(1)
+
+ deps = projects_deps[project]
+ ret[project] = deps
+
+ for dep in deps:
+ if dep not in ret:
+ queue += [dep]
+
+ return ret
+
def gen_makefile_clone(proj, src, src_proj, update_src_copy_cmd):
if proj == "osmocom-bb_layer23":
return f'''
@@ -555,6 +592,7 @@
'''
projects_deps = read_projects_deps(all_deps_file)
+projects_deps = filter_projects_deps_targets()
projects_urls = read_projects_dict(all_urls_file)
projects_buildsystems = read_projects_dict(all_buildsystems_file)
configure_opts = listdict()
@@ -631,6 +669,8 @@
content += " --build-debug \\\n"
if args.autoreconf_in_src_copy:
content += " --autoreconf-in-src-copy \\\n"
+if args.targets:
+ content += f" --targets={shlex.quote(args.targets)} \\\n"
content += " $(NULL)\n"
if args.autoreconf_in_src_copy:
diff --git a/tests/test_gen_makefile.py b/tests/test_gen_makefile.py
index 2ae0667..6232003 100644
--- a/tests/test_gen_makefile.py
+++ b/tests/test_gen_makefile.py
@@ -64,3 +64,14 @@
run_cmd(["./gen_makefile.py", "-m", tmp_path, "--autoreconf-in-src-copy"], cwd=osmo_dev_path)
run_cmd(["make", ".make.open5gs.configure"], cwd=tmp_path)
run_make_regen_2x(tmp_path)
+
+
+def test_gen_makefile_with_targets_arg(tmp_path):
+ run_cmd(["./gen_makefile.py", "-m", tmp_path, "--targets", "trxcon,osmo-mgw"], cwd=osmo_dev_path)
+ run_cmd("grep -q '^osmocom-bb_trxcon_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_cmd("grep -q '^osmo-mgw_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_cmd("grep -q '^libosmocore_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_cmd("! grep -q '^osmo-bts_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_cmd("! grep -q '^osmo-s1gw_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_cmd("! grep -q '^open5gs_files :=' Makefile", cwd=tmp_path, shell=True)
+ run_make_regen_2x(tmp_path)
--
To view, visit https://gerrit.osmocom.org/c/osmo-dev/+/40839?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: osmo-dev
Gerrit-Branch: master
Gerrit-Change-Id: I89bb60e94dd03606dbba5a3609d5e1a95993af5b
Gerrit-Change-Number: 40839
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith(a)sysmocom.de>
Paul Bichis has restored this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/40833?usp=email )
Change subject: Create rpm make targets and add libosmo-abis.spec.in
......................................................................
Restored
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/40833?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: restore
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I86c2c621887d1d9352f3ddfa1270c1379cf50fd9
Gerrit-Change-Number: 40833
Gerrit-PatchSet: 2
Gerrit-Owner: Paul Bichis <paul(a)afk.ro>
Gerrit-Reviewer: Jenkins Builder
Paul Bichis has abandoned this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/40833?usp=email )
Change subject: Create rpm make targets and add libosmo-abis.spec.in
......................................................................
Abandoned
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/40833?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: abandon
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I86c2c621887d1d9352f3ddfa1270c1379cf50fd9
Gerrit-Change-Number: 40833
Gerrit-PatchSet: 2
Gerrit-Owner: Paul Bichis <paul(a)afk.ro>
Gerrit-Reviewer: Jenkins Builder
Paul Bichis has abandoned this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/40832?usp=email )
Change subject: Create rpm make targets and add libosmo-abis.spec.in
......................................................................
Abandoned
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/40832?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: abandon
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I199d1168538b5220571c42b1fc35c7f5f9f3e4b4
Gerrit-Change-Number: 40832
Gerrit-PatchSet: 2
Gerrit-Owner: Paul Bichis <paul(a)afk.ro>
Gerrit-Reviewer: Jenkins Builder
fixeria has posted comments on this change by fixeria. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40831?usp=email )
Change subject: enb_uptime: track eNB uptime
......................................................................
Set Ready For Review
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40831?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Ie8a06fafa2ce3e7a5aec1eb8e71af3053599cf24
Gerrit-Change-Number: 40831
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Comment-Date: Tue, 05 Aug 2025 11:16:25 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40831?usp=email )
Change subject: enb_uptime: track eNB uptime
......................................................................
enb_uptime: track eNB uptime
Change-Id: Ie8a06fafa2ce3e7a5aec1eb8e71af3053599cf24
Related: SYS#7594
---
M include/s1gw_metrics.hrl
A src/enb_uptime.erl
M src/s1ap_proxy.erl
3 files changed, 107 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-s1gw refs/changes/31/40831/1
diff --git a/include/s1gw_metrics.hrl b/include/s1gw_metrics.hrl
index db087c5..83ec768 100644
--- a/include/s1gw_metrics.hrl
+++ b/include/s1gw_metrics.hrl
@@ -37,9 +37,10 @@
-define(S1GW_CTR_S1AP_PROXY_OUT_PKT_REPLY_ALL, [ctr, s1ap, proxy, out_pkt, reply, all]).
-define(S1GW_CTR_S1AP_PROXY_OUT_PKT_REPLY_ERAB_SETUP_RSP, [ctr, s1ap, proxy, out_pkt, reply, erab_setup_rsp]).
-%% GTP-U (traffic) related counters
+%% per-eNB counters
%% NOTE: these counters shall not be listed in ?S1GW_COUNTERS,
%% but created dynamically for each connecting eNB.
+-define(S1GW_CTR_ENB_UPTIME(ENBId), [ctr, enb, ENBId, uptime]).
-define(S1GW_CTR_GTPU_PACKETS(ENBId, UDL), [ctr, enb, ENBId, gtpu, packets, UDL]).
-define(S1GW_CTR_GTPU_BYTES_UE(ENBId, UDL), [ctr, enb, ENBId, gtpu, bytes, ue, UDL]).
-define(S1GW_CTR_GTPU_BYTES_TOTAL(ENBId, UDL), [ctr, enb, ENBId, gtpu, bytes, total, UDL]).
diff --git a/src/enb_uptime.erl b/src/enb_uptime.erl
new file mode 100644
index 0000000..4c6f76a
--- /dev/null
+++ b/src/enb_uptime.erl
@@ -0,0 +1,99 @@
+%% Copyright (C) 2025 by sysmocom - s.f.m.c. GmbH <info(a)sysmocom.de>
+%% Author: Vadim Yanitskiy <vyanitskiy(a)sysmocom.de>
+%%
+%% All Rights Reserved
+%%
+%% SPDX-License-Identifier: AGPL-3.0-or-later
+%%
+%% This program is free software; you can redistribute it and/or modify
+%% it under the terms of the GNU Affero General Public License as
+%% published by the Free Software Foundation; either version 3 of the
+%% License, or (at your option) any later version.
+%%
+%% This program is distributed in the hope that it will be useful,
+%% but WITHOUT ANY WARRANTY; without even the implied warranty of
+%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+%% GNU General Public License for more details.
+%%
+%% You should have received a copy of the GNU Affero General Public License
+%% along with this program. If not, see <https://www.gnu.org/licenses/>.
+%%
+%% Additional Permission under GNU AGPL version 3 section 7:
+%%
+%% If you modify this Program, or any covered work, by linking or
+%% combining it with runtime libraries of Erlang/OTP as released by
+%% Ericsson on https://www.erlang.org (or a modified version of these
+%% libraries), containing parts covered by the terms of the Erlang Public
+%% License (https://www.erlang.org/EPLICENSE), the licensors of this
+%% Program grant you additional permission to convey the resulting work
+%% without the need to license the runtime libraries of Erlang/OTP under
+%% the GNU Affero General Public License. Corresponding Source for a
+%% non-source form of such a combination shall include the source code
+%% for the parts of the runtime libraries of Erlang/OTP used as well as
+%% that of the covered work.
+
+-module(enb_uptime).
+
+-export([start_link/0,
+ genb_id_ind/2,
+ shutdown/1]).
+
+-include_lib("kernel/include/logger.hrl").
+
+-include("s1gw_metrics.hrl").
+
+-define(INTERVAL, 5_000).
+
+
+%% ------------------------------------------------------------------
+%% public API
+%% ------------------------------------------------------------------
+
+-spec start_link() -> pid().
+start_link() ->
+ T0 = erlang:monotonic_time(),
+ spawn_link(fun() -> loop(#{time => T0}) end).
+
+
+-spec genb_id_ind(pid(), string()) -> ok.
+genb_id_ind(Pid, GlobalENBId) ->
+ Pid ! {?FUNCTION_NAME, GlobalENBId},
+ ok.
+
+
+-spec shutdown(pid()) -> ok.
+shutdown(Pid) ->
+ Pid ! stop,
+ ok.
+
+
+%% ------------------------------------------------------------------
+%% private API
+%% ------------------------------------------------------------------
+
+loop(#{genb_id := GlobalENBId, time := T0} = S) ->
+ receive
+ stop ->
+ s1gw_metrics:ctr_reset(?S1GW_CTR_ENB_UPTIME(GlobalENBId)),
+ ok;
+ Event ->
+ ?LOG_ERROR("Rx unexpected event: ~p", [Event])
+ after ?INTERVAL ->
+ T1 = erlang:monotonic_time(),
+ Diff = erlang:convert_time_unit(T1 - T0, native, second),
+ s1gw_metrics:ctr_inc(?S1GW_CTR_ENB_UPTIME(GlobalENBId), Diff),
+ ?LOG_INFO("Td ~p second(s)", [Diff]),
+ loop(S#{time => T1})
+ end;
+
+loop(#{} = S) ->
+ receive
+ {genb_id_ind, GlobalENBId} ->
+ catch exometer:new(?S1GW_CTR_ENB_UPTIME(GlobalENBId), counter),
+ loop(S#{genb_id => GlobalENBId});
+ Event ->
+ ?LOG_ERROR("Rx unexpected event: ~p", [Event])
+ end.
+
+
+%% vim:set ts=4 sw=4 et:
diff --git a/src/s1ap_proxy.erl b/src/s1ap_proxy.erl
index 06e5302..813a8d1 100644
--- a/src/s1ap_proxy.erl
+++ b/src/s1ap_proxy.erl
@@ -78,7 +78,8 @@
mme_ue_id :: undefined | mme_ue_id(),
enb_ue_id :: undefined | enb_ue_id(),
erab_id :: undefined | erab_id(),
- path :: [s1ap_ie_id()]
+ path :: [s1ap_ie_id()],
+ enb_uptime :: pid()
}).
-type proxy_state() :: #proxy_state{}.
@@ -127,7 +128,8 @@
init([ConnInfo]) ->
process_flag(trap_exit, true),
- {ok, #proxy_state{conn_info = ConnInfo,
+ {ok, #proxy_state{enb_uptime = enb_uptime:start_link(),
+ conn_info = ConnInfo,
erabs = dict:new(),
path = []}}.
@@ -167,7 +169,8 @@
{noreply, S}.
-terminate(Reason, #proxy_state{}) ->
+terminate(Reason, #proxy_state{} = S) ->
+ enb_uptime:shutdown(S#proxy_state.enb_uptime),
?LOG_NOTICE("Terminating, reason ~p", [Reason]),
ok.
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-s1gw/+/40831?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: erlang/osmo-s1gw
Gerrit-Branch: master
Gerrit-Change-Id: Ie8a06fafa2ce3e7a5aec1eb8e71af3053599cf24
Gerrit-Change-Number: 40831
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>