Jump to content
  • Advertisement

MilindSP

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

100 Neutral

About MilindSP

  • Rank
    Newbie
  1. MilindSP

    Help with timers on Linux

    Hey I am sorry for delayed response on thread I am using select call for socket activities .. In case of semaphore its sem_timedwait is used for specific time duration .. Here is something which I tried to simulate the same scenario but unsuccessful . I wrote some dummy code with similar logic and API I changed system time but in that case all events and activities are going smooth .. However when all clubbed in application with multiple threads (to be precise 12) application shows strange behavior .. It slows down If i move system timer back and shoots up cpu usage in case timer is moved ahead .. Also I have used clock_gettimeofday(MONOTONIC) which is system timer independent.. Anybody has seen such behavior please help .. Any inputs for performance optimization are also welcome ..
  2. [font=arial, verdana, tahoma, sans-serif][size=2] Hey guys [/font][font=arial, verdana, tahoma, sans-serif][size=2] I have application in which I am waiting on semaphore and network event for certain amount of time .[/font] Application works smooth as long as nobody tampers the system time. The moment system time is changed Application starts utilizing high CPU and becomes slow .. I am using socket events and semaphores .. Any clue on the same will help a lot Please let me know if further information required on same. Thanks In advance..
  3. MilindSP

    Help with timers on Linux

    Hey guys Thanks for all help ... However I presented question incorrectly . I have application in which I am waiting on semaphore and network event for certain amount of time . Application works smooth as long as nobody tampers the system time. The moment system time is changed Application starts utilizing high CPU and becomes slow .. I am using socket events and semaphores .. Any clue on the same will help a lot Thanks In advance..
  4. [font="Verdana"]Hey All,[/font] [font="Verdana"] [/font] [font="Verdana"]I have application which runs on windows and Linux. [/font] [font="Verdana"] [/font] [font="Verdana"]Its rely on timers. In windows I could find way to implement system independent timer using gettickcount() API.[/font] [font="Verdana"] [/font] [font="Verdana"]However under linux I am using gettimeofday() / clock_gettime() which depends on system Time.[/font] [font="Verdana"] [/font] [font="Verdana"]If user or any other application changes system time, It adversely affect my application.[/font] [font="Verdana"] [/font] [font="Verdana"]After doing lil google I found times() API can be used along with [color=#1C2837]sysconf to implement system independent timer. However when I read man pages for times() It is very confusing on how to use it.[/font] [font="Verdana"] [/font] [font="Verdana"]Here is what I am doing in my app[/font] [font="Verdana"] [/font] [font="Verdana"]clock_gettime(CLOCK_REALTIME,&start);[/font] [font="Verdana"]Some activity ()[/font] [font="Verdana"]clock_gettime(CLOCK_REALTIME,&stop);[/font] [font="Verdana"] [/font][font="Verdana"]if (diff(stop - star) ) [/font][font="Verdana"]then[/font][font="Verdana"] some activity[/font][font="Verdana"] [/font][font="Verdana"]If during activity system time changes it affect My logic ..[/font] [font="Verdana"] [/font] [font="Verdana"]If anybody has already used the same, I would like to see code or pseudo code whichever possible.[/font] [font="Verdana"] [/font] [font="Verdana"]Thanks for help ..[/font]
  5. MilindSP

    best way to GetTickCount in Linux

    Hey Guys, Can anyone put the actual code showing how to implement timer using times(). I am using gettimeofday() function however my application gets affected due to change in system timer. I would like to avoid this scenario. Thanks in advance.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!