Permalink
Browse files

add pipe monitoring (debug() functions)

  • Loading branch information...
asquared committed Feb 1, 2012
1 parent b4d38b1 commit 8c224993777d705d1865406e523722fece0a1f12
Showing with 26 additions and 0 deletions.
  1. +8 −0 replay/replay_app.rb
  2. +5 −0 replay/replay_ingest.cpp
  3. +2 −0 replay/replay_ingest.h
  4. +1 −0 replay/replay_ingest.i
  5. +10 −0 thread/pipe.h
View
@@ -38,6 +38,10 @@ def initialize(opts={})
end
end
+ def debug
+ @ingest.debug
+ end
+
def suspend_encode
@ingest.suspend_encode
end
@@ -188,6 +192,10 @@ def resume_encode
@sources.each { |source| source.resume_encode }
end
+ def debug
+ @sources.each { |source| source.debug }
+ end
+
def start_irb
IRB.start_session(binding())
end
View
@@ -34,6 +34,11 @@ ReplayIngest::~ReplayIngest( ) {
}
+void ReplayIngest::debug( ) {
+ fprintf(stderr, "ingest for %s\n", buf->get_name( ));
+ iadp->output_pipe( ).debug( );
+}
+
void ReplayIngest::run_thread( ) {
RawFrame *input, *thumb;
ReplayRawFrame *monitor_frame;
View
@@ -40,6 +40,8 @@ class ReplayIngest : public Thread {
void suspend_encode( );
void resume_encode( );
+ void debug( );
+
protected:
void run_thread( );
View
@@ -32,5 +32,6 @@ class ReplayIngest : public Thread {
void suspend_encode( );
void resume_encode( );
+ void debug( );
};
View
@@ -167,6 +167,16 @@ class Pipe {
}
}
+ void debug(void) {
+ MutexLock lock(mut);
+ if (read_ptr <= write_ptr) {
+ fprintf(stderr, "pipe: %u used\n", (write_ptr - read_ptr));
+ } else {
+ fprintf(stderr, "pipe: %u used\n",
+ (buf_len - read_ptr) + (write_ptr - 1));
+ }
+ }
+
~Pipe( ) {
for (unsigned int i = 0; i < buf_len; i++) {
if (buf[i] != NULL) {

0 comments on commit 8c22499

Please sign in to comment.