Skip to content

Commit 7e32ef7

Browse files
Merge pull request #24 from microsoft/matt/stats_range_issue
Matt/stats range issue
2 parents 2147bbb + 4fca03e commit 7e32ef7

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

jrtc_apps/xran_packets/xran_packets.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,14 @@
2222

2323
##########################################################################
2424
# Define the state variables for the application
25-
class AppStateVars(ctypes.Structure):
26-
_fields_ = [
27-
("app", ctypes.POINTER(JrtcApp))
28-
]
25+
@dataclass
26+
class AppStateVars:
27+
app: JrtcApp
2928

3029

3130
##########################################################################
3231
# Handler callback function (this function gets called by the C library)
33-
def app_handler(timeout: bool, stream_idx: int, data_entry_ptr: ctypes.POINTER(struct_jrtc_router_data_entry), state_ptr: int):
32+
def app_handler(timeout: bool, stream_idx: int, data_entry: struct_jrtc_router_data_entry, state: AppStateVars):
3433

3534
XRAN_CODELET_OUT_SIDX = 0
3635

@@ -41,10 +40,6 @@ def app_handler(timeout: bool, stream_idx: int, data_entry_ptr: ctypes.POINTER(s
4140
pass
4241

4342
else:
44-
45-
# Dereference the pointer arguments
46-
state = ctypes.cast(state_ptr, ctypes.POINTER(AppStateVars)).contents
47-
data_entry = data_entry_ptr.contents
4843

4944
if stream_idx == XRAN_CODELET_OUT_SIDX:
5045

@@ -61,6 +56,7 @@ def app_handler(timeout: bool, stream_idx: int, data_entry_ptr: ctypes.POINTER(s
6156
print(f"Hi App 1: timestamp: {data.timestamp}")
6257
print(f"DL Ctl: {dl_control_stats.Packet_count} {list(dl_control_stats.packet_inter_arrival_info.hist)}")
6358
print(f"DL Data: {dl_data_stats.Packet_count} {dl_data_stats.Prb_count} {list(dl_data_stats.packet_inter_arrival_info.hist)}")
59+
print(f"UL Data: {ul_data_stats.Packet_count} {ul_data_stats.Prb_count} {list(ul_data_stats.packet_inter_arrival_info.hist)}")
6460

6561

6662
##########################################################################
@@ -91,7 +87,7 @@ def jrtc_start_app(capsule):
9187
)
9288

9389
# Initialize the app
94-
state = AppStateVars()
90+
state = AppStateVars(app=None)
9591
state.app = jrtc_app_create(capsule, app_cfg, app_handler, state)
9692

9793
# run the app - This is blocking until the app exists

0 commit comments

Comments
 (0)