VirtualBox

Ignore:
Timestamp:
Nov 2, 2009 8:26:07 PM (15 years ago)
Author:
vboxsync
Message:

AsyncCompletion: Cleanup in the cache and more statistics (more to come)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/PDMAsyncCompletionFile.cpp

    r24059 r24278  
    4242#include <iprt/string.h>
    4343#include <iprt/thread.h>
     44#include <iprt/path.h>
    4445
    4546#include "PDMAsyncCompletionFileInternal.h"
     
    693694    }
    694695
     696#ifdef VBOX_WITH_STATISTICS
     697    if (RT_SUCCESS(rc))
     698    {
     699        STAMR3RegisterF(pEpClassFile->Core.pVM, &pEpFile->StatRead,
     700                       STAMTYPE_PROFILE_ADV, STAMVISIBILITY_ALWAYS,
     701                       STAMUNIT_TICKS_PER_CALL, "Time taken to read from the endpoint",
     702                       "/PDM/AsyncCompletion/File/%s/Read", RTPathFilename(pEpFile->Core.pszUri));
     703
     704        STAMR3RegisterF(pEpClassFile->Core.pVM, &pEpFile->StatWrite,
     705                       STAMTYPE_PROFILE_ADV, STAMVISIBILITY_ALWAYS,
     706                       STAMUNIT_TICKS_PER_CALL, "Time taken to write to the endpoint",
     707                       "/PDM/AsyncCompletion/File/%s/Write", RTPathFilename(pEpFile->Core.pszUri));
     708    }
     709#endif
     710
    695711    return rc;
    696712}
     
    728744    RTFileClose(pEpFile->File);
    729745
     746#ifdef VBOX_WITH_STATISTICS
     747    STAMR3Deregister(pEpClassFile->Core.pVM, &pEpFile->StatRead);
     748    STAMR3Deregister(pEpClassFile->Core.pVM, &pEpFile->StatWrite);
     749#endif
     750
    730751    return VINF_SUCCESS;
    731752}
     
    736757                           size_t cbRead)
    737758{
     759    int rc = VINF_SUCCESS;
    738760    PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEndpoint;
    739761
     762    STAM_PROFILE_ADV_START(&pEpFile->StatRead, Read);
     763
    740764    if (pEpFile->fCaching)
    741         return pdmacFileEpCacheRead(pEpFile, (PPDMASYNCCOMPLETIONTASKFILE)pTask,
    742                                     off, paSegments, cSegments, cbRead);
     765        rc = pdmacFileEpCacheRead(pEpFile, (PPDMASYNCCOMPLETIONTASKFILE)pTask,
     766                                  off, paSegments, cSegments, cbRead);
    743767    else
    744         return pdmacFileEpTaskInitiate(pTask, pEndpoint, off, paSegments, cSegments, cbRead,
    745                                        PDMACTASKFILETRANSFER_READ);
     768        rc = pdmacFileEpTaskInitiate(pTask, pEndpoint, off, paSegments, cSegments, cbRead,
     769                                     PDMACTASKFILETRANSFER_READ);
     770
     771    STAM_PROFILE_ADV_STOP(&pEpFile->StatRead, Read);
     772
     773    return rc;
    746774}
    747775
     
    751779                            size_t cbWrite)
    752780{
     781    int rc = VINF_SUCCESS;
    753782    PPDMASYNCCOMPLETIONENDPOINTFILE pEpFile = (PPDMASYNCCOMPLETIONENDPOINTFILE)pEndpoint;
    754783
     
    756785        return VERR_NOT_SUPPORTED;
    757786
     787    STAM_PROFILE_ADV_START(&pEpFile->StatWrite, Write);
     788
    758789    if (pEpFile->fCaching)
    759         return pdmacFileEpCacheWrite(pEpFile, (PPDMASYNCCOMPLETIONTASKFILE)pTask,
    760                                      off, paSegments, cSegments, cbWrite);
     790        rc = pdmacFileEpCacheWrite(pEpFile, (PPDMASYNCCOMPLETIONTASKFILE)pTask,
     791                                   off, paSegments, cSegments, cbWrite);
    761792    else
    762         return pdmacFileEpTaskInitiate(pTask, pEndpoint, off, paSegments, cSegments, cbWrite,
    763                                        PDMACTASKFILETRANSFER_WRITE);
     793        rc = pdmacFileEpTaskInitiate(pTask, pEndpoint, off, paSegments, cSegments, cbWrite,
     794                                     PDMACTASKFILETRANSFER_WRITE);
     795
     796    STAM_PROFILE_ADV_STOP(&pEpFile->StatWrite, Write);
     797
     798    return rc;
    764799}
    765800
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