• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Embedded Systems Software
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Sommersemester 2025
      • Applied Software Architecture
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    • Wintersemester 2025/26
      • Systemprogrammierung 2
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
      • Projekt angewandte Systemsoftwaretechnik
      • Aktuelle Entwicklung in Verteilten und Objektorientierten Betriebssystemen (für Bachelor-/Masterarbeit)
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • Betriebssysteme

    Aufgabe 5: Zeitscheiben

    Enumerations | Functions
    TSC Namespace Reference

    Access to the Timestamp Counter (of the current Core) More...

    Enumerations

    enum  Instruction {
      RDTSC ,
      RDTSCP ,
      CPUID_RDTSC ,
      RDTSCP_CPUID ,
      CR0_RDTSC
    }
     

    Functions

    uint32_t ticks (bool use_pit=false)
     Gather the TSC frequency in ticks per milliseconds. More...
     
    bool available (Instruction instruction=RDTSC)
     Check availability of TSC. More...
     
    uint64_t nanoseconds (uint64_t delta)
     Convert a timestamp delta value to nanoseconds. More...
     
    void delay (uint64_t us)
     Actively wait the provided waiting time. More...
     
    uint64_t read (Instruction instruction=RDTSC)
     Reads the current timestamp counter. More...
     

    Detailed Description

    Access to the Timestamp Counter (of the current Core)

    Intel Manual Vol. 3, 17.17 Time-Stamp Counter

    Enumeration Type Documentation

    enum TSC::Instruction
    Enumerator
    RDTSC 

    TSC Read with possible out-of-order execution.

    RDTSCP 

    Pseudo serializing.

    CPUID_RDTSC 

    Serializing (via CPUID) TSC read for begin of benchmark.

    RDTSCP_CPUID 

    Serializing (via CPUID) TSC read for end of benchmark.

    CR0_RDTSC 

    Serializing (via CR0) TSC read for end of benchmark if RDTSCP is not supported.

    Function Documentation

    uint32_t TSC::ticks ( bool  use_pit = false)

    Gather the TSC frequency in ticks per milliseconds.

    Parameters
    use_pitEnforces the usage of the PIT if set, otherwise the processor infos are queried, at first.
    Returns
    Number of TSC ticks per milliseconds
    Optional:
    Implement calibration via PIT (in the local function ticksByPit()). For testing, it might be useful to compare the return values with different values of use_pit. The returned values should be similar 🙂
    bool TSC::available ( Instruction  instruction = RDTSC)

    Check availability of TSC.

    Parameters
    instructionTest for the (unserialized) RDTSC or pseudo serializing RDTSCP instruction
    Returns
    true if RDTSC[P] is available
    uint64_t TSC::nanoseconds ( uint64_t  delta)

    Convert a timestamp delta value to nanoseconds.

    Note
    It is necessary to execute TSC::ticks() prior calling this function the first time, since it uses the cached TSC frequency value gathered by ticks() for the calculation.
    Parameters
    deltaDelta between two timestamps
    Returns
    Equivalent time in nanoseconds
    Optional:
    Implement conversion
    void TSC::delay ( uint64_t  us)

    Actively wait the provided waiting time.

    Note
    It is necessary to execute TSC::ticks() prior calling this function the first time, since it uses the cached TSC frequency value gathered by ticks() for the calculation.
    Parameters
    uswaiting time in microseconds
    Optional:
    Implement conversion
    uint64_t TSC::read ( Instruction  instruction = RDTSC)
    inline

    Reads the current timestamp counter.

    While reading the timestamp counter is quite easy, it is difficult to prevent out-of-order execution.

    See also
    How to Benchmark Code Execution Times on Intel® IA-32 and IA-64 Instruction Set Architectures [benchmark_code_execution.pdf]
    Parameters
    instructionInstruction(s) used to read timestamp counter
    Returns
    Timestamp in TSC ticks
    Friedrich-Alexander-Universität
    Erlangen-Nürnberg

    Schlossplatz 4
    91054 Erlangen
    • Impressum
    • Datenschutz
    • Barrierefreiheit
    • Facebook
    • RSS Feed
    • Xing
    Nach oben