Skip to content

Commit 90efc05

Browse files
ofxOscReceiver dyna alloc stress test: better state change handling for STABLE test (#7994)
* better state change handling for STABLE test * remove extra logging --------- Co-authored-by: alexandre burton <burton@artificiel.org>
1 parent 77663bf commit 90efc05

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

apps/devApps/StressofxOscReceiver/src/ofApp.cpp

+18-12
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ void ofApp::update(){
4747
for (const auto & tester: testers_) {
4848
for (size_t i=0; i<10; i++) {
4949
#if defined(USE_EXPLICIT_FUNCTION)
50-
ofxOscMessage m;
51-
m.setAddress("/test");
52-
m.addIntArg(std::int32_t(i));
53-
m.addIntArg(port_);
54-
m.addIntArg(i);
55-
tester->sender_->sendMessage(m);
50+
ofxOscMessage m;
51+
m.setAddress("/test");
52+
m.addIntArg(std::int32_t(i));
53+
m.addIntArg(port_);
54+
m.addIntArg(i);
55+
tester->sender_->sendMessage(m);
5656
#else
57-
ofxOscMessage m{"/test"};
58-
m.add(i);
59-
tester->sender_->sendMessage(m.add(port_).add(i));
57+
ofxOscMessage m{"/test"};
58+
m.add(i);
59+
tester->sender_->sendMessage(m.add(port_).add(i));
6060
#endif
6161
msgs_out_++;
6262
}
@@ -93,8 +93,14 @@ void ofApp::draw() {
9393
void ofApp::keyPressed(int key){
9494
if (key=='1' ) mode_ = DYNA;
9595
if (key=='2' ) mode_ = STOP;
96-
if (key=='3' ) mode_ = STABLE;
97-
msgs_ = 0;
98-
msgs_out_ = 0;
96+
if (key=='3' ) {
97+
mode_ = STABLE;
98+
for (const auto & tester: testers_) {
99+
if (!tester->receiver_->isListening()) {
100+
tester->receiver_->start();
101+
}
102+
}
103+
}
104+
reset_stats();
99105
}
100106

apps/devApps/StressofxOscReceiver/src/ofApp.h

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class ofApp : public ofBaseApp{
1616
STABLE
1717
};
1818

19+
1920
Mode mode_ { DYNA };
2021
long msgs_ { 0 };
2122
long msgs_out_ { 0 };
@@ -28,6 +29,10 @@ class ofApp : public ofBaseApp{
2829

2930
std::array<std::shared_ptr<Tester>, 10> testers_;
3031

32+
auto reset_stats() {
33+
msgs_ = 0;
34+
msgs_out_ = 0;
35+
}
3136

3237
public:
3338
void setup() override;

0 commit comments

Comments
 (0)