EDIT No. 1

My task is mirroring , i.e., copying updated data from master server to all mirrors, by using rsync and rsh. But during rsync and rsh, I found some delay. My thinking is , the reason for delay is reverse DNS lookup. So I want to make log for time consumed in reverse dns lookup process, when master server connects with mirror server.

In my application I want to detect reverse DNS lookup system call called or not. So, for that which command helps ?

For reverse DNS Lookup , system call is getnameinfo(),. if you any other , tell me.

I just want to trace only this system call in my project. Which command can I use?

I know ltrace/strace command to trace all system call called till script exits, but that makes extra overhead, because all system call trace is not of use in my project.

I want to make log for time consumed in reverse dns lookup during rsync and rsh.

Help me in my problem.

  • How about dtrace? (what OS?)
    – michael
    Commented Mar 3, 2013 at 11:14
  • @michael_n Os is CentOS.
    – devsda
    Commented Mar 3, 2013 at 12:05

2 Answers 2


First of all, getnameinfo is not a system call, but a glibc function.

But anyway, just run wireshark to monitor traffic, it works for DNS query.


To profile an app, try gprof, perhaps read this guide

  • My task is to calculate time during reverse dns lookup, only. My task is mirroring, i.e, copying updated data to all mirrors from master server(for that I use rsync, rsh). Is it help me in my task ?
    – devsda
    Commented Mar 3, 2013 at 6:14
  • @FreakyCheeky perhaps try gprof like tools to profile function calls, that way you might know the time spent on each C function
    – daisy
    Commented Mar 3, 2013 at 8:28
  • DNS lookup (even reverse lookup) can take some time the first time around, afterwards the result is cached. It is very unlikely to be the cause of any significant delays.
    – vonbrand
    Commented Mar 3, 2013 at 16:34
  • 1
    @vonbrand Failing lookups are often not cached. Reverse lookups often time out, and this is a fairly common cause of delays. Commented Mar 3, 2013 at 23:28

Usually it's the server that does a reverse DNS lookup on the client's IP, and no amount of tracing the client will tell you that.

What you need to do is check the configuration or the network activity on the server. strace and the like aren't a good match for this: look at the network activity, e.g. with tcpdump or Wireshark.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .