Hi Jakob and v8-users,​​
I have following observations on printing logs in v8 and date.now call
trace.

   1. *Logs in v8:*

   *printf* and *std::cout* were not outputting any logs in adb logcat. I
   ​tried redirecting stdio logs to logcat by following commands -

   $ adb shell stop$ adb shell setprop log.redirect-stdio true$ adb shell start

   But still logs were not getting displayed in adb logcat. So I used
   android log library. Following is the procedure

   - Import header file:

      #if defined(V8_OS_ANDROID)
        #include <android/log.h>
      #endif

      - Print log:

      #if defined(V8_OS_ANDROID)
        __android_log_print(ANDROID_LOG_INFO, "<TAG>", "<MESSAGE>");
      #endif


   2. Date.now() final system call:
   Date.now() calls *V8Platform::CurrentClockTimeMillis()* from*
   src/gin/v8_platform.cc *---> *Time::Now() *from *src/base/time/time.cc*
   ---> *getTimeofDay() *rather than *base::OS::TimeCurrentMillis. *Can
   anyone explain this behaviour?

Regards,
K Abhishek



On Mon, Jun 18, 2018 at 7:07 PM Jakob Kummerow <jkumme...@chromium.org>
wrote:

> Sure, just use printf or std::cout << "print\n". I don't know whether adb
> logcat has any special requirements.
>
> On Mon, Jun 18, 2018 at 3:48 PM Abhishek Kanike <
> kai.dranzer32...@gmail.com> wrote:
>
>> Jakob,
>> Thanks for quick reply.
>> That's a good point, should have tried with gdb. Will check with that.
>> Is there a way to add logs in v8 source code, it will be lot faster to
>> debug.
>> In cc (compositor), i used *LOG(INFO)<<"print";* from *base/logging.h *(of
>> main chromium *src*)
>>
>> On Mon, Jun 18, 2018 at 5:12 PM Jakob Kummerow <jkumme...@chromium.org>
>> wrote:
>>
>>> Yes, it is.
>>>
>>> Have you tried using a debugger? You can set a breakpoint in
>>> the BUILTIN(DateNow) function here:
>>>
>>>
>>> https://cs.chromium.org/chromium/src/v8/src/builtins/builtins-date.cc?q=builtins-date.cc&sq=package:chromium&dr&l=282
>>>
>>> and step through the code from there.
>>>
>>> On Mon, Jun 18, 2018 at 2:39 PM Abhishek Kanike <
>>> kai.dranzer32...@gmail.com> wrote:
>>>
>>>> ​Hi,
>>>> For confirmation i am using a simple Date.now() call on button click
>>>> [Attached].
>>>> I have added a print log in Time::NOW() at
>>>> https://cs.chromium.org/chromium/src/v8/src/base/platform/time.cc?type=cs&sq=package:chromium&g=0&l=402
>>>> as printf("v8:DEBUG::TIME:NOW called").
>>>> I am not getting this log in adb logcat. So is this the correct place
>>>> from where Date.now() is getting called?
>>>>
>>>> Regards,
>>>> K Abhishek
>>>>
>>>> On Mon, May 21, 2018 at 6:51 PM Abhishek Kanike <
>>>> kai.dranzer32...@gmail.com> wrote:
>>>>
>>>>> Sorry JaKob
>>>>>
>>>>> On Mon, May 21, 2018, 6:51 PM Abhishek Kanike <
>>>>> kai.dranzer32...@gmail.com> wrote:
>>>>>
>>>>>> Cool.. I see it. Thanks a lot Jacob.
>>>>>>
>>>>>> On Mon, May 21, 2018, 5:40 PM Jakob Kummerow <jkumme...@chromium.org>
>>>>>> wrote:
>>>>>>
>>>>>>> The time always has to be retrieved from the kernel. V8's
>>>>>>> implementation is in base::OS::TimeCurrentMillis, implemented in
>>>>>>> src/base/platform/platform-{win32,posix}.cc.
>>>>>>>
>>>>>>> On Mon, May 21, 2018 at 3:22 PM Abhishek Kanike <
>>>>>>> kai.dranzer32...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi,
>>>>>>>> I want to know how the date.now() function is called in javascript
>>>>>>>> (or how it returns the value). I believe that javascript uses 
>>>>>>>> date.now() by
>>>>>>>> system call. I want to in chrome source code how it is being set.
>>>>>>>> This is useful for one of the performance benchmark that I am
>>>>>>>> working on.
>>>>>>>> Can someone please guide me to know how this happens in v8 engine.
>>>>>>>>
>>>>>>>> Thanks in advance.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> K Abhishek
>>>>>>>>
>>>>>>>> --
>>>>>>>> --
>>>>>>>> v8-users mailing list
>>>>>>>> v8-users@googlegroups.com
>>>>>>>> http://groups.google.com/group/v8-users
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "v8-users" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>>
>>>>>>> --
>>>>>>> --
>>>>>>> v8-users mailing list
>>>>>>> v8-users@googlegroups.com
>>>>>>> http://groups.google.com/group/v8-users
>>>>>>> ---
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "v8-users" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to v8-users+unsubscr...@googlegroups.com.
>>>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>>>
>>>>>>
>>>>
>>>> --
>>>> Cheers,
>>>> K Abhishek
>>>>
>>>> --
>>>> --
>>>> v8-users mailing list
>>>> v8-users@googlegroups.com
>>>> http://groups.google.com/group/v8-users
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "v8-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to v8-users+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>> --
>>> --
>>> v8-users mailing list
>>> v8-users@googlegroups.com
>>> http://groups.google.com/group/v8-users
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "v8-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to v8-users+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>> --
>> Cheers,
>> K Abhishek
>>
>> --
>> --
>> v8-users mailing list
>> v8-users@googlegroups.com
>> http://groups.google.com/group/v8-users
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "v8-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to v8-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Cheers,
K Abhishek

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to