VirtualBox

Ignore:
Timestamp:
Jan 16, 2023 3:17:49 PM (23 months ago)
Author:
vboxsync
Message:

Main/Console: Implemented a LED query optimization, where also keep track of LEDs on a per-type. This will prevent scanning all the sets and also skip any DeviceType_Null entries. bugref:9892

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r98091 r98095  
    657657
    658658/**
     659 * Updates the device type for a LED.
     660 *
     661 * @param   penmSubTypeEntry    The sub-type entry to update.
     662 * @param   enmNewType          The new type.
     663 */
     664void Console::i_setLedType(DeviceType_T *penmSubTypeEntry, DeviceType_T enmNewType)
     665{
     666    /*
     667     * ASSUMES no race conditions here wrt concurrent type updating.
     668     */
     669    if (*penmSubTypeEntry != enmNewType)
     670    {
     671        *penmSubTypeEntry = enmNewType;
     672        ASMAtomicIncU32(&muLedGen);
     673    }
     674}
     675
     676
     677/**
    659678 * Allocate a set of LEDs.
    660679 *
     
    738757 * @throws ConfigError and std::bad_alloc.
    739758 */
    740 void Console::i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType)
     759void Console::i_attachStatusDriver(PCFGMNODE pCtlInst, DeviceType_T enmType, uint32_t cLeds /*= 1*/)
    741760{
    742761    Assert(enmType > DeviceType_Null && enmType < DeviceType_End);
    743     i_attachStatusDriver(pCtlInst, RT_BIT_32(enmType), 1, NULL, NULL, NULL, 0);
     762    i_attachStatusDriver(pCtlInst, RT_BIT_32(enmType), cLeds, NULL, NULL, NULL, 0);
    744763}
    745764
     
    21842203                     * Attach the status driver.
    21852204                     */
    2186                     i_attachStatusDriver(pInst, RT_BIT_32(DeviceType_USB), 2, NULL, NULL, NULL, 0);
     2205                    i_attachStatusDriver(pInst, DeviceType_USB, 2);
    21872206                }
    21882207            } /* for every USB controller. */
     
    24852504
    24862505                    /* Attach the status driver */
    2487                     i_attachStatusDriver(pCtlInst, DeviceType_Floppy, 2, NULL,
    2488                                          &mapMediumAttachments, pszCtrlDev, ulInstance);
     2506                    i_attachStatusDriver(pCtlInst, RT_BIT_32(DeviceType_Floppy),
     2507                                         2, NULL, &mapMediumAttachments, pszCtrlDev, ulInstance);
    24892508                    break;
    24902509                }
     
    50975116
    50985117        if (paLedDevType)
    5099             paLedDevType[uLUN] = enmType;
     5118            i_setLedType(&paLedDevType[uLUN], enmType);
    51005119
    51015120        /* Dump the changed LUN if possible, dump the complete device otherwise */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette