projects
/
debian
/
gnuradio
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4676782
)
gnuradio-core: adds configurable flush to file sink
author
Marcus D Leech
<mleech@ripnet.com>
Sun, 16 May 2010 15:38:30 +0000
(08:38 -0700)
committer
Johnathan Corgan
<jcorgan@corganenterprises.com>
Sun, 16 May 2010 15:38:30 +0000
(08:38 -0700)
gnuradio-core/src/lib/io/gr_file_sink.cc
patch
|
blob
|
history
gnuradio-core/src/lib/io/gr_file_sink_base.cc
patch
|
blob
|
history
gnuradio-core/src/lib/io/gr_file_sink_base.h
patch
|
blob
|
history
gnuradio-core/src/lib/io/gr_file_sink_base.i
patch
|
blob
|
history
grc/blocks/gr_file_sink.xml
patch
|
blob
|
history
diff --git
a/gnuradio-core/src/lib/io/gr_file_sink.cc
b/gnuradio-core/src/lib/io/gr_file_sink.cc
index d40235fab9a39815321794e4be78f96b3bdd36e1..d2c43aac7a31b1d8434db077d04640dc4ffcad66 100644
(file)
--- a/
gnuradio-core/src/lib/io/gr_file_sink.cc
+++ b/
gnuradio-core/src/lib/io/gr_file_sink.cc
@@
-70,5
+70,8
@@
gr_file_sink::work (int noutput_items,
nwritten += count;
inbuf += count * d_itemsize;
}
nwritten += count;
inbuf += count * d_itemsize;
}
+ if (d_unbuffered)
+ fflush (d_fp);
+
return nwritten;
}
return nwritten;
}
diff --git
a/gnuradio-core/src/lib/io/gr_file_sink_base.cc
b/gnuradio-core/src/lib/io/gr_file_sink_base.cc
index 5ddeeb4d5686fffc8aadfc0ca1e725ce95d03ffb..c43304b0d37f1d07859b53a85a45e54f27b5f263 100644
(file)
--- a/
gnuradio-core/src/lib/io/gr_file_sink_base.cc
+++ b/
gnuradio-core/src/lib/io/gr_file_sink_base.cc
@@
-118,3
+118,9
@@
gr_file_sink_base::do_update()
d_updated = false;
}
}
d_updated = false;
}
}
+
+void
+gr_file_sink_base::set_unbuffered(bool unbuffered)
+{
+ d_unbuffered = unbuffered;
+}
diff --git
a/gnuradio-core/src/lib/io/gr_file_sink_base.h
b/gnuradio-core/src/lib/io/gr_file_sink_base.h
index 0c028d7fd3adcf7413f688d68bf5e8aaca602321..7b96cdb7f3758bbe5ef2d1c578dc0d50d0e8fe10 100644
(file)
--- a/
gnuradio-core/src/lib/io/gr_file_sink_base.h
+++ b/
gnuradio-core/src/lib/io/gr_file_sink_base.h
@@
-37,6
+37,7
@@
class gr_file_sink_base
bool d_updated; // is there a new FILE pointer?
bool d_is_binary;
boost::mutex d_mutex;
bool d_updated; // is there a new FILE pointer?
bool d_is_binary;
boost::mutex d_mutex;
+ bool d_unbuffered;
protected:
gr_file_sink_base(const char *filename, bool is_binary);
protected:
gr_file_sink_base(const char *filename, bool is_binary);
@@
-61,6
+62,12
@@
class gr_file_sink_base
* \brief if we've had an update, do it now.
*/
void do_update();
* \brief if we've had an update, do it now.
*/
void do_update();
+
+
+ /*!
+ * \brief turn on unbuffered writes for slower outputs
+ */
+ void set_unbuffered(bool unbuffered);
};
};
diff --git
a/gnuradio-core/src/lib/io/gr_file_sink_base.i
b/gnuradio-core/src/lib/io/gr_file_sink_base.i
index 05a3353bb4e6010da558a1c599a062ad81874bc8..ed4342482ddef2c343a56edfec1a7ee58e750070 100644
(file)
--- a/
gnuradio-core/src/lib/io/gr_file_sink_base.i
+++ b/
gnuradio-core/src/lib/io/gr_file_sink_base.i
@@
-43,4
+43,9
@@
class gr_file_sink_base
* \brief if we've had an update, do it now.
*/
void do_update();
* \brief if we've had an update, do it now.
*/
void do_update();
+
+ /*!
+ *\brief turn on unbuffered mode for slow outputs
+ */
+ void set_unbuffered(bool unbuffered);
};
};
diff --git
a/grc/blocks/gr_file_sink.xml
b/grc/blocks/gr_file_sink.xml
index 880dc27590c013447038f718849701c334505ca6..0081c93f8f5a25c15582c0f2acc73acfe36415e7 100644
(file)
--- a/
grc/blocks/gr_file_sink.xml
+++ b/
grc/blocks/gr_file_sink.xml
@@
-8,7
+8,9
@@
<name>File Sink</name>
<key>gr_file_sink</key>
<import>from gnuradio import gr</import>
<name>File Sink</name>
<key>gr_file_sink</key>
<import>from gnuradio import gr</import>
- <make>gr.file_sink($type.size*$vlen, $file)</make>
+ <make>gr.file_sink($type.size*$vlen, $file)
+self.$(id).set_unbuffered($unbuffered)</make>
+ <callback>set_unbuffered($unbuffered)</callback>
<param>
<name>File</name>
<key>file</key>
<param>
<name>File</name>
<key>file</key>
@@
-51,6
+53,21
@@
<value>1</value>
<type>int</type>
</param>
<value>1</value>
<type>int</type>
</param>
+ <param>
+ <name>Unbuffered</name>
+ <key>unbuffered</key>
+ <value>False</value>
+ <type>bool</type>
+ <option>
+ <name>Off</name>
+ <key>False</key>
+ </option>
+ <option>
+ <name>On</name>
+ <key>True</key>
+ </option>
+ </param>
+
<check>$vlen > 0</check>
<sink>
<name>in</name>
<check>$vlen > 0</check>
<sink>
<name>in</name>