[Lldb-commits] [PATCH 1/2] Removed use of NSEC_PER_SEC.

Marco Minutoli mminutoli at gmail.com
Wed Apr 6 22:56:50 PDT 2011


No I don't have commit access. So please do it for me.

Thank you.
Marco

On Thu, Apr 7, 2011 at 12:12 AM, Greg Clayton <gclayton at apple.com> wrote:

> Looks good. Marco, do you have commit access? If so, commit when you get
> the chance. Else I will do so on your behalf.
>
> Greg Clayton
>
> On Apr 6, 2011, at 1:44 PM, Marco Minutoli wrote:
>
> > NSEC_PER_SEC is not defined in sys/time.h on Linux. I have replaced
> > that macro with a static constant inside TimeValue.
> > ---
> > include/lldb/Host/TimeValue.h                      |    2 ++
> > .../gdb-remote/GDBRemoteCommunicationClient.cpp    |   12 ++++++------
> > 2 files changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/lldb/Host/TimeValue.h
> b/include/lldb/Host/TimeValue.h
> > index 81d1aed..04b6015 100644
> > --- a/include/lldb/Host/TimeValue.h
> > +++ b/include/lldb/Host/TimeValue.h
> > @@ -29,6 +29,8 @@ namespace lldb_private {
> > class TimeValue
> > {
> > public:
> > +    static const uint32_t NanoSecondPerSecond = 1000000000U;
> > +
> >     //------------------------------------------------------------------
> >     // Constructors and Destructors
> >     //------------------------------------------------------------------
> > diff --git
> a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
> b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
> > index d0198a0..7ad3d44 100644
> > --- a/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
> > +++ b/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
> > @@ -1385,13 +1385,13 @@ GDBRemoteCommunicationClient::TestPacketSpeed
> (const uint32_t num_packets)
> >                 }
> >                 end_time = TimeValue::Now();
> >                 total_time_nsec =
> end_time.GetAsNanoSecondsSinceJan1_1970() -
> start_time.GetAsNanoSecondsSinceJan1_1970();
> > -                packets_per_second =
> (((float)num_packets)/(float)total_time_nsec) * (float)NSEC_PER_SEC;
> > +                packets_per_second =
> (((float)num_packets)/(float)total_time_nsec) *
> (float)TimeValue::NanoSecondPerSecond;
> >                 printf ("%u qSpeedTest(send=%-5u, recv=%-5u) in
> %llu.%09.9llu sec for %f packets/sec.\n",
> >                         num_packets,
> >                         send_size,
> >                         recv_size,
> > -                        total_time_nsec / NSEC_PER_SEC,
> > -                        total_time_nsec % NSEC_PER_SEC,
> > +                        total_time_nsec /
> TimeValue::NanoSecondPerSecond,
> > +                        total_time_nsec %
> TimeValue::NanoSecondPerSecond,
> >                         packets_per_second);
> >                 if (recv_size == 0)
> >                     recv_size = 32;
> > @@ -1409,11 +1409,11 @@ GDBRemoteCommunicationClient::TestPacketSpeed
> (const uint32_t num_packets)
> >         }
> >         end_time = TimeValue::Now();
> >         total_time_nsec = end_time.GetAsNanoSecondsSinceJan1_1970() -
> start_time.GetAsNanoSecondsSinceJan1_1970();
> > -        packets_per_second =
> (((float)num_packets)/(float)total_time_nsec) * (float)NSEC_PER_SEC;
> > +        packets_per_second =
> (((float)num_packets)/(float)total_time_nsec) *
> (float)TimeValue::NanoSecondPerSecond;
> >         printf ("%u 'qC' packets packets in 0x%llu%09.9llu sec for %f
> packets/sec.\n",
> >                 num_packets,
> > -                total_time_nsec / NSEC_PER_SEC,
> > -                total_time_nsec % NSEC_PER_SEC,
> > +                total_time_nsec / TimeValue::NanoSecondPerSecond,
> > +                total_time_nsec % TimeValue::NanoSecondPerSecond,
> >                 packets_per_second);
> >     }
> > }
> > --
> > 1.7.1
> >
> > _______________________________________________
> > lldb-commits mailing list
> > lldb-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>


-- 
Marco Minutoli

"If A is success in life, then A equals x plus y plus z. Work is x;
y is play; and z is keeping your mouth shut." --A. Einstein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20110407/ed7cd5d9/attachment.html>


More information about the lldb-commits mailing list