Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature wanted] thread safe method to flush counters in dataplane #208

Open
w1nda opened this issue Dec 17, 2024 · 1 comment
Open

[feature wanted] thread safe method to flush counters in dataplane #208

w1nda opened this issue Dec 17, 2024 · 1 comment

Comments

@w1nda
Copy link
Contributor

w1nda commented Dec 17, 2024

We need a thread safe method to flush counters in dataplane, as there may many thread sharing the same dataplane instance:(

dataplane_instance = None

Counters:

ptf/src/ptf/dataplane.py

Lines 571 to 575 in c554f83

# counters of received packets (may include packets which were dropped due to queue overflow)
self.rx_counters = defaultdict(int)
# counters of transmited packets
self.tx_counters = defaultdict(int)

@w1nda w1nda changed the title [feature wanted] [feature wanted] thread safe method to flush counters in dataplane Dec 17, 2024
@jafingerhut
Copy link
Collaborator

Would something as straightforward as acquiring a lock around all accesses to rx_counters / tx_counters do what you are asking for? If so, are you interested in submitting a PR for review that does this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants