fbpx
× Visual Objects

Please use this forum to post questions about Visual Objects and Vulcan.NET

VO 2.8: GetTickCountLow() does not seem to work correctly anymore

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago #1 by wriedmann
Hi,

I have a very strange issue in VO: the function GetTickCountLow() seems to not give the expected results anymore.

It returns the same value all the time, and for all applications (my console test application returns the same value as my large application from another project).

This is reproducible also in a small console application:



I have also added a zipped AEF, so you can test this.

My OS is a fully patched Windows 10 Pro.

On a Windows Server 2008 R2 it the test application works as expected, giving different results.

Wolfgang
Attachments:

Please Log in or Create an account to join the conversation.

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago #2 by wriedmann
Hello,

I have now found the source of the problem: since Windows 10 does not fully restarts, but goes in a sort of sleep mode, it does not resets these counters when shutting down and starting again - you need a "restart" to reset them.

And in my understanding, after 5 days the counter should restart from 0 after reaching the limit of a double (the 2008 server is running for more than 5 days....).

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #3 by ArneOrtlinghaus
Hi Wolfgang,
I have tested it, it is the same for me on a fully patched Win10 Pro. But we haven't never used this function before.

Arne

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #4 by Chris
Hi Wolfgang,

Hmm, that's interesting, I'm on Win7 and I never shut it down (only sleep/hibernate), and I can also see the problem with the VO code. But in x#/vulcan, it works correctly, I always do get a different value as expected. Looks like a bug in the VO runtime to me, the function probably tries to be smart in returning a value with no overflow but fails somehow. In the vulcan runtime this function simply uses Environment.TickCount() which works nicely as it seems.

Chris

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago #5 by wriedmann
Hi Chris,

I thought about testing it in X#, but had not the time to do it.

Thank you for confirming it!

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #6 by ic2
Hello Wolfgang,

Interesting. Apparently you force a complete shutdown by creating a containing C:\Windows\System32\shutdown.exe /s /f /t 0

See here

1 I wonder if shutdown from Classic Shell menu does do a full shutdown. (as they have more command including Hibernate, which I suspect could be the 'normal' W10 shutdown.
2 I have most machines (pc, internet router and monitors) connected to a power cord with a switch so I always shut down power completely at night and parts of the weekend. I wonder if a shutdown like this still means Windows keeps starting from a hibernation file. It would explain a lot of W10 problems.

Dick

Please Log in or Create an account to join the conversation.

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago #7 by wriedmann
Hi Dick,

this is my main development notebook that is shutdown at night, and since I work at customers sites most of my days, it is started again at least 3 times a day (in the morning in my office, later at customers site, and at the evening agian in my office).

It is a known fact that Windows 10 uses a sort of standby to startup faster, but I don't knew that it does not resetted these counters. Combined with the (confirmed) bug in the VO runtime library it leds to unexpected results.

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #8 by ArneOrtlinghaus
With every new operating system version we discover some parts that do not work as before. But in total Windows 10 works very well - stable, good performance, nice windows design. Most users accept this Windows version. If our programs will work with future releases as until now we can be happy.

Arne

Please Log in or Create an account to join the conversation.

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago - 1 year 2 months ago #9 by wriedmann
Hi Arne,

I agree: Windows 10 is the most stable and well working Windows version of the last years. It had some suprises, but less than earlier versions, and most were caused by a programmer error (to be clear: mine).

Microsoft seems to understand that one of the most important things to maintain Windows alive is to give a stable application execution platform to the companies to this world (including themself with their Office software).

Wolfgang
Last edit: 1 year 2 months ago by wriedmann.

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #10 by ic2
Hello Arno, Wolfgang,

Performance of W10 is good, Window design a matter of taste. Compare for example the attractive Alarms & Clocks with the circular dials which worked very well to quickly select hours & minutes. This is replaced by the very basic app looking like gray toilet paper and a scroll list which is taking much more effort and mouse clicks to find a minute amount in the higher numbers. I don't know what you prefer but the old app was much better and nicer looking. Also I always install the W7 calculator because it accepts both a . and , as decimal point while the W10 app doesn't.

There are countless problems with W10. Much more than with W7. I've written an article about it (Dutch...) webwereld.nl/software/100992-windows-10-...-we-er-op-te-wachten . I don't think Microsoft is doing a good job. Considerable faster startup & shut down times and a few small improvements (and maybe the W10 apps but they are more a nice idea than something the world is waiting for) balance W10 IMO to a very small advantage above W7. And as we see in this subject, even that fast start comes at a price...

Dick

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #11 by Karl-Heinz
Hi Wolfgang

on my laptop runs win8.1(64-Bit) and in vmware machines win7(32 Bit) and win10(64-Bit).

GetTickcountlow() works correctly under win7, but already Win8.1 returns the same value as win10 does: 4294967295 ( MAX_DWORD == 0xFFFFFFFF ). What i don´t understand: what is the VO runtime func GetTickCountLow() good for, when it works (at least) in Win < 8 the same way as the WinApi GetTickCount() does ? BTW. To overcome the GettickcOunt() limit, GetTickCount64() can be used:

_DLL FUNCTION GetTickCount64() AS _winULARGE_INTEGER PASCAL:Kernel32.GetTickCount64

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #12 by Otto
Or you use

GetQueryPerformanceCounter(@start_high,@start_low)


see the attachment
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #13 by Chris
Hi Dick,

Dick wrote: Considerable faster startup & shut down times and a few small improvements


I am very surprised you bought into that :-)
If you don't completely shut down but instead sort of hibernate, like W10 does, every windows version is as fast or faster on opening/closing than what W10 is :)

Chris

XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago #14 by wriedmann
Hi Karl-Heinz,

I'm preferring VO runtime functions to Windows API functions, and even when I need a Windows API function in one of my applications, I try to encapsulate it in a VO function or class method to be able to change it in the case it becomes outdated or a better implementation is available. And now, when migrating to X#, it makes it easier to migrate.

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #15 by ic2
Hello Chris,

I have 2 reasons not to hibernate:

1 I'm extremely energy conscious. I try to switch everything off which isn't needed, including the many stand-by functions, Pc hibernation and also internet access.
2 For customers we really have to restart servers once every few weeks because they have become very slow, or erratic. I believe not restarting a Pc gives the same problem.

So when I start my Pc, Windows 10 is there well within 30- seconds, internet access within a minute. The W10 startup time is considerably faster than that of W7 so for me it's one of the (few) W10 advantages.

Dick

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #16 by ArneOrtlinghaus
Hi Dick,
in many parts you are right. But we have to admit that the times of the desktop computers as the main IT instrument have finished. And we are tight to the Microsoft Windows X86 world. So we can be glad if Microsoft modernizes that world and that most of our program code is still working. So I don't want always to complain about changes in Windows versions. Instead using Windows 10 and installing the latest patches we get impressions what future versions will bring us.
Arne

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #17 by Karl-Heinz

Wolfgang Riedmann wrote: Hi Karl-Heinz,

I'm preferring VO runtime functions to Windows API functions, and even when I need a Windows API function in one of my applications, I try to encapsulate it in a VO function
Wolfgang


Hi Wolfgang,

so, why not override the VO-Func ?

FUNCTION GetTickCountLow() AS DWORD PASCAL
RETURN GetTickCount()

BTW. i´m still wondering what GetTickcountLow() does internally. Take a look at the nummbers shown in the attached counter.jpg ... It shows - after a restart - the GetTicketCount64(),GetTicketCountLow() and GetTickcount() values.

Can anybody confirm this with the attached Counter.aef ?

regards
Karl-Heinz
Attachments:

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #18 by FFF
Karl-Heinz,
imported in 2838, shows similiar numbers like your jpg. -Low seems to add at every call simply digit 0-9 to the result...

HAND
Karl

Please Log in or Create an account to join the conversation.

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
More
1 year 2 months ago #19 by wriedmann
Hi Karl-Heinz, hi Karl,

I can confirm both of your findings.

Of course the use of the GetTickCount64() function solves any problems, but I don't plan to enhance my VO code very much - I hope to move it over to X# in the next few years.

Wolfgang

Please Log in or Create an account to join the conversation.

More
1 year 2 months ago #20 by Karl-Heinz

Karl Faller wrote: Karl-Heinz,
imported in 2838, shows similiar numbers like your jpg. -Low seems to add at every call simply digit 0-9 to the result...

HAND
Karl


Hi Karl,

and making a number larger ensures that the MAXDWORD limit is reached earlier ;-). Interesting also: The GetTickCOuntLow() doc mentions to divide the Result with 10000, while the winapi GetTickCOunt() result must be divided by 1000 to receive the elapsed seconds.

67227651 / 10000 -> 6722
6722765 / 1000 -> 6722

From that point of view GetTickCOuntLow() even makes sense, somehow ;-). Ok, i give up. If Wolfgang wouldn´t have mentioned it, i would never have noticed that this strange func exists at all in the VO runtime. ;-)

regards
Karl-Heinz

Please Log in or Create an account to join the conversation.