-----BEGIN PGP SIGNATURE-----

Version: GnuPG v1
 
 iQEcBAABAgAGBQJU1MViAAoJEJykq7OBq3PIOmcH/3YHS4xuNrPeyFDHS+fDcWQ0
 xrNoEIbjDIGWpJ5yRPKk/1yooW4E6PJiHHr3qFyKFUdYx+0uwqr8VK2nxWDPGijv
 BFY/tRW2TfmiEV66hR1OnSO9vtRtC/vOkxqFP2COlilY8rLpxFdYV0xCUYqczvOR
 ytSi+SgzToqPDu8laBzc7vfRX4KcKQx+a4+PqyTfJePkFXo4zM9hzMXKobMmcoLS
 Gtx9v280jhNKjwMPQBfGasSrDvf0t0Xpzg5rURpxkIxIS+H+xgrVIevENfd0JWtG
 7CN7GTb5Y0QjUppKNlQvzEYlmJko9DqpMsLdFaDyJJ4g1FGF26zoADryIykefVs=
 =Tdi7
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' into staging

# gpg: Signature made Fri 06 Feb 2015 13:45:06 GMT using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/tracing-pull-request:
  trace: Print PID and time in stderr traces

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-02-06 13:46:12 +00:00
commit b93acb92ca

View File

@ -21,6 +21,9 @@ PUBLIC = True
def generate_h_begin(events):
out('#include <stdio.h>',
'#include <sys/time.h>',
'#include <sys/types.h>',
'#include <unistd.h>',
'#include "trace/control.h"',
'')
@ -31,7 +34,12 @@ def generate_h(event):
argnames = ", " + argnames
out(' if (trace_event_get_state(%(event_id)s)) {',
' fprintf(stderr, "%(name)s " %(fmt)s "\\n" %(argnames)s);',
' struct timeval _now;',
' gettimeofday(&_now, NULL);',
' fprintf(stderr, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
' getpid(),',
' (size_t)_now.tv_sec, (size_t)_now.tv_usec',
' %(argnames)s);',
' }',
event_id="TRACE_" + event.name.upper(),
name=event.name,