View source for Timestamp
Jump to:
navigation
,
search
=Generating Timestamps= I've run into compiled code (no source available) that did not timestamp debugging output. This created problems for troubleshooting. What's a mother to do? We're looking to do something like this: <pre> progam_being_debugged 2>&1 | timestamp_generator > badapp.log </pre> There are many ways to do this, "this" being "program_being_debugged". I tried a few ways of doing it: *shell *awk *daemontools (tai64n[local]) *ts (from moreutils; see "moreutils" page on this wiki) *perl Of course there are some other ways to do this: write a 'C' program (don't know if 'ts' is written in C or something else), try various other languages. However, the scope of this project was "quick & dirty" with the emphasis on quick. Nonetheless, I managed to carve out the time necessary to test the methods above. Note that when debugging, we often want to 'tail' the output to watch what's going on in realtime, and possibly use our monkey minds to attempt to correlate with external events. Like so: <pre> program_being_debugged 2>&1 | timestamp_generator | tail -f </pre> In this case, it's important to minimize buffering along the pipeline so that output gets to our optical sensors as quickly as possible. ==Results== A simple shell script harness was used for the testing: <pre> example </pre> This was run on a machine under Ubuntu 14.10. Here are the results: ==shell== ==awk== ==daemontools== ==ts== ==perl==
Return to
Timestamp
.
Navigation menu
Personal tools
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
Actions
Search
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Toolbox
What links here
Related changes
Special pages
Page information