Any good profiler for coding in Ansi C for gwan like xhprof for php?

176 views Asked by At

Looking for web based c proiler tool similar to xhprof and for Linux. Any good recommendations for gwan scripting? Thanks in advance.

1

There are 1 answers

2
Gil On BEST ANSWER

A G-WAN profiler would have to both report issues for:

  • code portions of G-WAN scripts (servlets and handlers)
  • blocking / poorly written scripts (not using events)
  • slow library or system calls, etc.

Rather than making a separate product, it may make more sense to use extra code in G-WAN scripts to check your workflow.

G-WAN provides several examples using very precise time functions like: cycles64(), getms(), getus(), and getns() to check how fast code portions or library calls are.

But G-WAN also provides server counters like REQUEST_TIME which will reveal performance and scalability issues in your applications.

Further, you can go deeper by using a connection handler to check the accept, parse, build and reply times:

enum HANDLER_ACT
{
   HDL_INIT = 0,
   HDL_AFTER_ACCEPT, // just after accept (client IP address setup)
   HDL_AFTER_READ,   // each time a read was done until HTTP request OK
   HDL_BEFORE_PARSE, // HTTP verb/URI validated but not HTTP headers
   HDL_AFTER_PARSE,  // HTTP headers validated, ready to build reply
   HDL_BEFORE_WRITE, // after a reply was built, but before it is sent
   HDL_AFTER_WRITE,  // after a reply was sent
   HDL_HTTP_ERRORS,  // when G-WAN is going to reply with an HTTP error
   HDL_BEFORE_CLOSE, // when G-WAN is going to close a connection
   HDL_CLEANUP
};

As G-WAN supports scripts in 17 programming languages, performance tuning may also involve doing the right choices for speed-critical parts of your applications.

You may want to use G-WAN C scripts for generating images on-the-fly and G-WAN PHP, C# or Java scripts for less critical tasks.

G-WAN lets you do that very easily.

Last but not least, G-WAN provides ab.c (an open-source benchmark tool) to let you identify scalability issues, most of which are discussed here.