Skip to content

Conversation

@Zadamsa
Copy link
Contributor

@Zadamsa Zadamsa commented Dec 2, 2024

No description provided.

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2024

Codecov Report

Attention: Patch coverage is 27.27273% with 32 lines in your changes missing coverage. Please review.

Project coverage is 40.70%. Comparing base (3a7d52d) to head (60a204f).
Report is 128 commits behind head on master.

Files with missing lines Patch % Lines
input/topPorts.cpp 20.00% 24 Missing ⚠️
input/input.cpp 0.00% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #238      +/-   ##
==========================================
- Coverage   40.79%   40.70%   -0.09%     
==========================================
  Files         104      105       +1     
  Lines       10126    10168      +42     
  Branches     1494     1493       -1     
==========================================
+ Hits         4131     4139       +8     
- Misses       5130     5164      +34     
  Partials      865      865              
Flag Coverage Δ
tests 40.70% <27.27%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Zadamsa Zadamsa force-pushed the top-10-ports branch 2 times, most recently from c723319 to abd2f62 Compare December 2, 2024 00:28
@Zadamsa Zadamsa force-pushed the top-10-ports branch 2 times, most recently from 7e649d8 to 8eaa5fa Compare December 9, 2024 12:28
input/parser.cpp Outdated
pkt->src_port = ntohs(udp->source);
pkt->dst_port = ntohs(udp->dest);

stats.top_ports.insert(pkt->src_port);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

V procesních vláknech, které provádí zpracování paketů by neměla být žádná složitější logika zbytečně navíc.
Tato aktualizace top portů má v sobě docela složitou logiku, která by tu být neměla.
Jediné, co by procesní vlákna zde měla dělat je zvýšení čítače pro daný port.

Veškerá složitější logika, která zobrazí top 10 portů atd. by se měla řešit při vyčítání telemetrii.

@Zadamsa Zadamsa force-pushed the top-10-ports branch 2 times, most recently from 6e0bb5d to 9285a37 Compare January 27, 2025 04:53
* \brief Get the top ports.
* \return Pair of the top ports array and their count.
*/
std::pair<std::array<std::pair<uint16_t, size_t>, TopPortsCount>, size_t>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Toto je opravdu hodne neprehledne, kde na prvni pohled vubec nevis o co jde.

Slo by to urcite lepe strukturovat, napr. takto:

struct PortStats {
    uint16_t portNumber;
    uint64_t portFrequency;
};

 // asi bych spise pouzil vector, protoze muzes mit i mene zachycenych portu nez tech TopPortsCount 
std::vector<PortStats>  get_top_ports() const

Co myslis?

std::pair<std::array<std::pair<uint16_t, size_t>, TopPortsCount>, size_t>
vs
std::vector<PortStats>

Zaroven by mi prislo i zajime, sbirat statistiky pro TCP a UDP zvlast.
Pak dat vysledek typu:

53 / UDP - 238243

@Zadamsa Zadamsa force-pushed the top-10-ports branch 2 times, most recently from 79a4bc1 to 944d19d Compare February 14, 2025 07:13
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

Successfully merging this pull request may close these issues.

3 participants