I'm trying to figure out whether AUCTeX is actually calling dvipng when it renders LaTeX previews. While this may not the best way to find this out, one possibility is to check whether the executable dvipng is being called at all - nothing else on the system would be using it. The compilation output does not mention dvipng, and top does not show it being run.

For non-emacs users, AUCTeX is an emacs package that runs inside emacs and can call external executables, i.e. dvipng.

So, my question is: for an arbitrary executable, is there some way to check whether and if so when, it has been run in the recent past? More information, like what arguments it has been called with, would also be useful.

I tried seeing whether the emacs process called dvipng by using strace (I don't know if I did this correctly) by doing

$ strace emacs corrmodel.tex 2>&1 | grep dvipng

and then running a compilation, but I just got the output

read(15, "falias 'preview-start-dvipng #[n"..., 4096) = 4096

Is this a correct procedure? Is there a better way?

  • strace without -f follows only one process. Try strace -fe execve -o /tmp/strace.log emacs.... – Stéphane Chazelas Jun 30 '13 at 20:51
  • @StephaneChazelas Ok, judging by the man page -f makes strace trace child processes, -e execve makes strace trace only program execution (execve). In any case, dvipng is not listed, so if my understanding if correct, it was not called. Question: would this trace grandchild processes? I.e. children of child processes? – Faheem Mitha Jun 30 '13 at 21:07
  • @StephaneChazelas: Additionally, using strace -fe execve produces lots of lines which look like 2833 --- SIGIO (I/O possible) @ 0 (0) ---. What do these mean, and can one get rid of them? In any case, can you make your comment into an answer? Thanks. – Faheem Mitha Jul 1 '13 at 7:55

If you do ls -lut /usr/bin/dvipng, it will tell you the time of last use. Won't that be a simple solution?

| improve this answer | |
  • 1
    Note that it will only work as long as noatime isn’t set, and the file system is writeable. But in this case it’s a good solution. – chirlu Jun 30 '13 at 23:19
  • Interesting. I didn't know ls could do that. It is currently reporting a time from yesterday for dvipng, though I just ran preview. Thanks. @chirlu: Can you expand on the noatime thing? And what filesystem needs to be writable? – Faheem Mitha Jul 1 '13 at 7:53
  • This access time (atime), as well as the other times associated with a file (ctime, mtime), is handled by the file system and stored with the file. If the file system on which, in your case, dvipng resides is mounted read-only, no update is possible. – Updating the atime for each and every file access can cause performance issues on high-load machines. It may also exacerbate SSD wear. Therefore, there is a mount option noatime to tell the file system not to update the atime when a file is accessed; and relatime as a compromise to update at most once a day, or after a write. – chirlu Jul 1 '13 at 8:55
  • @chirlu: Thanks for the clarification. Neither of the provisos apply in my case. Note: to notify someone of a response you add their name prefixed by @. You probably already know, but I thought I would mention it. – Faheem Mitha Jul 1 '13 at 9:51
  • @Faheem Mitha: I thought you would be notified automatically, but it seems only the author of the answer is, not the author of the original question. – chirlu Jul 1 '13 at 10:22

The way I usually do it - quick and dirty - is to rename /usr/bin/dvipng to /usr/bin/dvipng.bin and then create a simple script named /usr/bin/dvipng like this:

echo "$*" > /tmp/dvipng-$$.log
exec /usr/bin/dvipng "$@"

Make it executable with chmod +x /usr/bin/dvipng and run whatever you want to run. Then check if /tmp/dvipng-*.log exists and if it does the content should be the list of arguments.

| improve this answer | |
  • Yes, I thought of doing something like that, but it isn't very elegant. I don't like messing with my system in this way. Thanks for the suggestion, though. – Faheem Mitha Jun 30 '13 at 22:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.