RtspSessionStats.hxx
上传用户:sy_wanhua
上传日期:2013-07-25
资源大小:3048k
文件大小:5k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

C/C++

  1. #ifndef RtspSessionStats_hxx
  2. #define RtspSessionStats_hxx
  3. /* ====================================================================
  4.  * The Vovida Software License, Version 1.0 
  5.  * 
  6.  * Copyright (c) 2000 Vovida Networks, Inc.  All rights reserved.
  7.  * 
  8.  * Redistribution and use in source and binary forms, with or without
  9.  * modification, are permitted provided that the following conditions
  10.  * are met:
  11.  * 
  12.  * 1. Redistributions of source code must retain the above copyright
  13.  *    notice, this list of conditions and the following disclaimer.
  14.  * 
  15.  * 2. Redistributions in binary form must reproduce the above copyright
  16.  *    notice, this list of conditions and the following disclaimer in
  17.  *    the documentation and/or other materials provided with the
  18.  *    distribution.
  19.  * 
  20.  * 3. The names "VOCAL", "Vovida Open Communication Application Library",
  21.  *    and "Vovida Open Communication Application Library (VOCAL)" must
  22.  *    not be used to endorse or promote products derived from this
  23.  *    software without prior written permission. For written
  24.  *    permission, please contact vocal@vovida.org.
  25.  *
  26.  * 4. Products derived from this software may not be called "VOCAL", nor
  27.  *    may "VOCAL" appear in their name, without prior written
  28.  *    permission of Vovida Networks, Inc.
  29.  * 
  30.  * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
  31.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  32.  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
  33.  * NON-INFRINGEMENT ARE DISCLAIMED.  IN NO EVENT SHALL VOVIDA
  34.  * NETWORKS, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT DAMAGES
  35.  * IN EXCESS OF 281421,000, NOR FOR ANY INDIRECT, INCIDENTAL, SPECIAL,
  36.  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  37.  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
  38.  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
  39.  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  40.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
  41.  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  42.  * DAMAGE.
  43.  * 
  44.  * ====================================================================
  45.  * 
  46.  * This software consists of voluntary contributions made by Vovida
  47.  * Networks, Inc. and many individuals on behalf of Vovida Networks,
  48.  * Inc.  For more information on Vovida Networks, Inc., please see
  49.  * <http://www.vovida.org/>.
  50.  *
  51.  */
  52. static const char* const RtspSessionStats_hxx_Version =
  53.     "$Id: RtspSessionStats.hxx,v 1.6 2001/05/15 20:26:08 bko Exp $";
  54. #include "vtypes.h"
  55. #include "Duration.hxx"
  56. #include <list>
  57. using namespace std;
  58. using Vocal::Statistics::TickCount;
  59. using Vocal::Statistics::Duration;
  60. typedef struct PerRecordReqData_t
  61. {
  62.         ///
  63.         int myPktsRecvd; //p1
  64.         ///
  65.         int myBytesRecvd; //p2
  66.         ///
  67.         // need an alternative for SunOS
  68.         Duration myStreamWaitRecvd; //p3
  69.         ///
  70.         // need an alternative for SunOS
  71.         Duration myPreStreamWaitRecvd; //p4
  72.         ///
  73.         bool myFirstPktsFlag;
  74. }
  75. PerRecordReqData;
  76. typedef struct PerPlayReqData_t
  77. {
  78.         ///
  79.         int myPktsSent; //q1
  80.         ///
  81.         int myBytesSent; //q2
  82.         ///
  83.         // need an alternative for SunOS
  84.         Duration myStreamWaitSent; //q3
  85. }
  86. PerPlayReqData;
  87. class RtspSessionStats
  88. {
  89.     public:
  90.         ///
  91.         RtspSessionStats();
  92.         ///
  93.         virtual ~RtspSessionStats() {}
  94.         ///
  95.         int totalPktsRecvd(); //I=sum n of p1
  96.         ///
  97.         int totalBytesRecvd(); //J=sum n of p2
  98.         ///PSW=pre-stream-wait
  99.         float totalRecPSW(); //W=sum n of p4~, (p4~=p4.length()/ticksPerSec)
  100.         ///
  101.         float averageRecPSW(); //=W/n
  102.         ///
  103.         float totalRecThroughput(); //X=sum of n p2/(p3~)
  104.         ///
  105.         float averageRecThroughput(); //=X/n
  106.         ///
  107.         float totalRecRoughThroughput(); //Y=sum of n p2/(p3~ + p4~)
  108.         ///
  109.         float averageRecRoughThroughput(); //=Y/n
  110.         ///
  111.         int totalRecRequests(); //n
  112.         ///
  113.         int totalPktsSent(); //K=sum m of q1
  114.         ///
  115.         int totalBytesSent(); //L=sum m of q2
  116.         ///
  117.         float totalPlyThroughput(); //Z=sum of m q2/(q3~)
  118.         ///
  119.         float averagePlyThroughput(); //=Z/m
  120.         ///
  121.         int totalPlyRequests(); //m
  122.         
  123.         ///
  124.         void report(const char* sessionId);
  125.         ///
  126.         typedef list< PerRecordReqData > RecordDataList;
  127.         RecordDataList myRecordDataList;
  128.         ///
  129.         typedef list< PerPlayReqData > PlayDataList;
  130.         PlayDataList myPlayDataList;
  131.         ///
  132.         int myCodecUsed;
  133. };
  134.         
  135. /* Local Variables: */
  136. /* c-file-style: "stroustrup" */
  137. /* indent-tabs-mode: nil */
  138. /* c-file-offsets: ((access-label . -) (inclass . ++)) */
  139. /* c-basic-offset: 4 */
  140. /* End: */
  141. #endif