VirtualBox

Changeset 27649 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Mar 23, 2010 10:43:29 PM (15 years ago)
Author:
vboxsync
Message:

RTTest: Added RTTest*Value* for reporting simple benchmark result. Implemented the test pipe + file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/test.h

    r26683 r27649  
    333333RTR3DECL(int) RTTestPassed(RTTEST hTest, const char *pszFormat, ...);
    334334
     335/**
     336 * Value units.
     337 */
     338typedef enum RTTESTUNIT
     339{
     340    /** The usual invalid value. */
     341    RTTESTUNIT_INVALID = 0,
     342    /** Percentage. */
     343    RTTESTUNIT_PCT,
     344    /** Bytes. */
     345    RTTESTUNIT_BYTES,
     346    /** Bytes per second. */
     347    RTTESTUNIT_BYTES_PER_SEC,
     348    /** Kilobytes. */
     349    RTTESTUNIT_KILOBYTES,
     350    /** Kilobytes per second. */
     351    RTTESTUNIT_KILOBYTES_PER_SEC,
     352    /** Megabytes. */
     353    RTTESTUNIT_MEGABYTES,
     354    /** Megabytes per second. */
     355    RTTESTUNIT_MEGABYTES_PER_SEC,
     356    /** Packets. */
     357    RTTESTUNIT_PACKETS,
     358    /** Packets per second. */
     359    RTTESTUNIT_PACKETS_PER_SEC,
     360    /** Frames. */
     361    RTTESTUNIT_FRAMES,
     362    /** Frames per second. */
     363    RTTESTUNIT_FRAMES_PER_SEC,
     364    /** Occurrences. */
     365    RTTESTUNIT_OCCURRENCES,
     366    /** Occurrences per second. */
     367    RTTESTUNIT_OCCURRENCES_PER_SEC,
     368    /** Calls. */
     369    RTTESTUNIT_CALLS,
     370    /** Calls per second. */
     371    RTTESTUNIT_CALLS_PER_SEC,
     372    /** Round trips. */
     373    RTTESTUNIT_ROUND_TRIP,
     374    /** Seconds. */
     375    RTTESTUNIT_SECS,
     376    /** Milliseconds. */
     377    RTTESTUNIT_MS,
     378    /** Nanoseconds. */
     379    RTTESTUNIT_NS,
     380    /** Nanoseconds per call. */
     381    RTTESTUNIT_NS_PER_CALL,
     382    /** Nanoseconds per frame. */
     383    RTTESTUNIT_NS_PER_FRAME,
     384    /** Nanoseconds per occurrence. */
     385    RTTESTUNIT_NS_PER_OCCURRENCE,
     386    /** Nanoseconds per frame. */
     387    RTTESTUNIT_NS_PER_PACKET,
     388    /** Nanoseconds per round trip. */
     389    RTTESTUNIT_NS_PER_ROUND_TRIP,
     390    /** The end of valid units. */
     391    RTTESTUNIT_END
     392} RTTESTUNIT;
     393
     394/**
     395 * Report a named test result value.
     396 *
     397 * This is typically used for benchmarking but can be used for other purposes
     398 * like reporting limits of some implementation.  The value gets associated with
     399 * the current sub test, the name must be unique within the sub test.
     400 *
     401 * @returns IPRT status code.
     402 *
     403 * @param   hTest       The test handle. If NIL_RTTEST we'll use the one
     404 *                      associated with the calling thread.
     405 * @param   pszName     The value name.
     406 * @param   u64Value    The value.
     407 * @param   enmUnit     The value unit.
     408 */
     409RTR3DECL(int) RTTestValue(RTTEST hTest, const char *pszName, uint64_t u64Value, RTTESTUNIT enmUnit);
     410
     411/**
     412 * Same as RTTestValue, except that the name is now a format string.
     413 *
     414 * @returns IPRT status code.
     415 *
     416 * @param   hTest       The test handle. If NIL_RTTEST we'll use the one
     417 *                      associated with the calling thread.
     418 * @param   u64Value    The value.
     419 * @param   enmUnit     The value unit.
     420 * @param   pszNameFmt  The value name format string.
     421 * @param   ...         String arguments.
     422 */
     423RTR3DECL(int) RTTestValueF(RTTEST hTest, uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, ...);
     424
     425/**
     426 * Same as RTTestValue, except that the name is now a format string.
     427 *
     428 * @returns IPRT status code.
     429 *
     430 * @param   hTest       The test handle. If NIL_RTTEST we'll use the one
     431 *                      associated with the calling thread.
     432 * @param   u64Value    The value.
     433 * @param   enmUnit     The value unit.
     434 * @param   pszNameFmt  The value name format string.
     435 * @param   va_list     String arguments.
     436 */
     437RTR3DECL(int) RTTestValueV(RTTEST hTest, uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, va_list va);
    335438
    336439/**
     
    702805
    703806/**
     807 * Report a named test result value.
     808 *
     809 * This is typically used for benchmarking but can be used for other purposes
     810 * like reporting limits of some implementation.  The value gets associated with
     811 * the current sub test, the name must be unique within the sub test.
     812 *
     813 * @returns IPRT status code.
     814 *
     815 * @param   pszName     The value name.
     816 * @param   u64Value    The value.
     817 * @param   enmUnit     The value unit.
     818 */
     819RTR3DECL(int) RTTestIValue(const char *pszName, uint64_t u64Value, RTTESTUNIT enmUnit);
     820
     821/**
     822 * Same as RTTestValue, except that the name is now a format string.
     823 *
     824 * @returns IPRT status code.
     825 *
     826 * @param   u64Value    The value.
     827 * @param   enmUnit     The value unit.
     828 * @param   pszNameFmt  The value name format string.
     829 * @param   ...         String arguments.
     830 */
     831RTR3DECL(int) RTTestIValueF(uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, ...);
     832
     833/**
     834 * Same as RTTestValue, except that the name is now a format string.
     835 *
     836 * @returns IPRT status code.
     837 *
     838 * @param   u64Value    The value.
     839 * @param   enmUnit     The value unit.
     840 * @param   pszNameFmt  The value name format string.
     841 * @param   va_list     String arguments.
     842 */
     843RTR3DECL(int) RTTestIValueV(uint64_t u64Value, RTTESTUNIT enmUnit, const char *pszNameFmt, va_list va);
     844
     845/**
    704846 * Increments the error counter.
    705847 *
     
    732874 */
    733875RTR3DECL(int) RTTestIFailed(const char *pszFormat, ...);
     876
     877/**
     878 * Increments the error counter, prints a failure message and returns the
     879 * specified status code.
     880 *
     881 * This is mainly a convenience method for saving vertical space in the source
     882 * code.
     883 *
     884 * @returns @a rcRet
     885 * @param   rcRet       The IPRT status code to return.
     886 * @param   pszFormat   The message. No trailing newline.
     887 * @param   va          The arguments.
     888 */
     889RTR3DECL(int) RTTestIFailedRcV(int rcRet, const char *pszFormat, va_list va);
     890
     891/**
     892 * Increments the error counter, prints a failure message and returns the
     893 * specified status code.
     894 *
     895 * This is mainly a convenience method for saving vertical space in the source
     896 * code.
     897 *
     898 * @returns @a rcRet
     899 * @param   rcRet       The IPRT status code to return.
     900 * @param   pszFormat   The message. No trailing newline.
     901 * @param   ...         The arguments.
     902 */
     903RTR3DECL(int) RTTestIFailedRc(int rcRet, const char *pszFormat, ...);
    734904
    735905/**
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