Laufzeit Dienststatusabfrage

    • Offizieller Beitrag

    Hi,
    ich prüfe mit folgender Funktion (hier zwei Varianten: per CMD und WMI) ob ein Dienst gestartet ist oder nicht.
    Könnt ihr mal testen, wie bei euch die Laufzeiten sind? Beide Varianten unterscheiden sich bei mir kaum. Aber in Win 7 dauert es bei mir ca. 1,7 s, dagegen in Win XP < 0,5 s.

    Edit:
    Bei der Laufzeit hatte ich mich vertan: WMI-Variante ist etwa 30% schneller. Aber 0,1 s in XP vs. 0,8 s in Win7.

  • Code
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.286 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.286 s
    Ergebnis: CMD True t=0.287 s 	 WMI True t=0.286 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.286 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.286 s

    Verwende allerdings noch eine alte Autoit Version und musste dein Return Statement aufgrund der neuen Schreibeweise durch eine if Bedingung ersetzen. Ansonsten aber das selbe Script.

    OS: Win7 Pro x64
    System: i7-4771 3,5Ghz mit SSD als System Festplatte

    Evtl. hat dein aktuelles System eine langsame Festplatte oder der Virenscanner wirkt sich negativ auf die Ausführung aus.

  • Öhm dein Script oben ist fehlerhaft. Du prüfst zweimal die CMD Variante, daher auch identische Ergebnisse.
    Hier die echten Ergebnisse (einmal CMD, einmal WMI):

    Code
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.065 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.055 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.054 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.055 s
    Ergebnis: CMD True t=0.286 s 	 WMI True t=0.053 s

    WMI ist bei mir deutlich schneller, was auch nicht wirklich verwundert, da durch den CMD Aufruf und die Auswertung sehr viel Zeit verloren geht.

  • Ergebnis: CMD True t=0.642 s WMI True t=0.443 s
    Ergebnis: CMD True t=0.373 s WMI True t=0.106 s
    Ergebnis: CMD True t=0.342 s WMI True t=0.080 s
    Ergebnis: CMD True t=0.349 s WMI True t=0.079 s
    Ergebnis: CMD True t=0.334 s WMI True t=0.077 s

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    OuBVU5ebLhHu5QvlnAyQB4A7SzBrvWulwL7RLl2BdH5tI6sIYspeMKeXMSXl

  • Win7/64 Laptop @700Mhz ,SSD

    Ergebnis: CMD True t=0.718 s WMI True t=1.347 s
    Ergebnis: CMD True t=0.572 s WMI True t=0.357 s
    Ergebnis: CMD True t=0.563 s WMI True t=0.349 s
    Ergebnis: CMD True t=0.572 s WMI True t=0.334 s
    Ergebnis: CMD True t=0.555 s WMI True t=0.332 s


    Nicht verwunderlich, da nach dem System/AutoIt-start WMI erstmal initialisiert werden muss...

    Bei wiederholten Aufrufen ergeben sich die "ganz normalen" Datenbankzugriffe.

    @2,3Ghz
    Ergebnis: CMD True t=0.395 s WMI True t=0.245 s
    Ergebnis: CMD True t=0.410 s WMI True t=0.142 s
    Ergebnis: CMD True t=0.420 s WMI True t=0.140 s
    Ergebnis: CMD True t=0.406 s WMI True t=0.143 s
    Ergebnis: CMD True t=0.418 s WMI True t=0.134 s

  • Win 8.1 x64:

    Code
    Ergebnis: CMD False t=0.512 s 	 WMI 0 t=1.298 s
    Ergebnis: CMD False t=0.325 s 	 WMI 0 t=0.310 s
    Ergebnis: CMD False t=0.324 s 	 WMI 0 t=0.277 s
    Ergebnis: CMD False t=0.322 s 	 WMI 0 t=0.322 s
    Ergebnis: CMD False t=0.310 s 	 WMI 0 t=0.316 s

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

  • Code
    Ergebnis: CMD True t=0.295 s 	 WMI True t=0.127 s
    Ergebnis: CMD True t=0.305 s 	 WMI True t=0.144 s
    Ergebnis: CMD True t=0.295 s 	 WMI True t=0.146 s
    Ergebnis: CMD True t=0.321 s 	 WMI True t=0.134 s
    Ergebnis: CMD True t=0.301 s 	 WMI True t=0.130 s

    Win 10 x64

  • Ergebnis: CMD True t=0.405 s WMI True t=0.398 s
    Ergebnis: CMD True t=0.384 s WMI True t=0.342 s
    Ergebnis: CMD True t=0.380 s WMI True t=0.354 s
    Ergebnis: CMD True t=0.379 s WMI True t=0.383 s
    Ergebnis: CMD True t=0.405 s WMI True t=0.391 s

    interessant, Win10 Tablet mit Prozessor Intel(R) Atom(TM) CPU Z3735F @ 1.33GHz, 1329 MHz, 4 Kern(e), 4 logische(r) Prozessor(en)
    CMD schneller als mein Laptop mit doppeltem Takt! Dafür WMI-Zugriff aber nur halb so schnell bzgl. Takt LaptopCPU
    Wie es aussieht, ist Intel bei WMI im Vorteil^^