 -		p = head();
 +
  		if (p && (clock_ - p->time_) > slop_) {
- 			fprintf(stderr,
- 				"RealTimeScheduler: warning: slop "
-@@ -1014,16 +1171,37 @@
+-			fprintf(stderr,
+-				"RealTimeScheduler: warning: slop "
+-				"%f exceeded limit %f [clock_:%f, p->time_:%f]\n",
+-				clock_ - p->time_, slop_, clock_, p->time_);
++		    num_violation_++;
++		    if (num_violation_ == 1 ) {
++			clock_first_violation_ = clock_;
++		    } else if(num_violation_ == VIOLATION_THRESHOLD) {
++			double diff = clock_ - clock_first_violation_;
++			if (diff < VIOLATION_TIME_THRESHOLD) {
++			    if (evsink_) {
++				evsink_->send_nseswap();
++			    }
++			} else {
++			    clock_first_violation_ = clock_;
++			    num_violation_ = 1;
++			}
++		    }
++		    fprintf(stderr,
++			    "RealTimeScheduler: warning: slop "
++			    "%f exceeded limit %f [clock_:%f, p->time_:%f]\n",
++			    clock_ - p->time_, slop_, clock_, p->time_);
++		    clock_ = tod();
+ 		}
  		// handle "old events"
  		while (p && p->time_ <= clock_) {
  

 }
 
 void
@@ -991,20 +1126,42 @@
 {
 	clock_ = SCHED_START;
 	start_ = tod();

   if (cc <= 0) {
     if (cc < 0) {
       perror("recv");
@@ -219,13 +364,64 @@
 }
 
 
