forked from Seagate/cortx-motr-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
107 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* -*- C -*- */ | ||
/* | ||
* COPYRIGHT 2014 SEAGATE LLC | ||
* | ||
* THIS DRAWING/DOCUMENT, ITS SPECIFICATIONS, AND THE DATA CONTAINED | ||
* HEREIN, ARE THE EXCLUSIVE PROPERTY OF SEAGATE LLC, | ||
* ISSUED IN STRICT CONFIDENCE AND SHALL NOT, WITHOUT | ||
* THE PRIOR WRITTEN PERMISSION OF SEAGATE TECHNOLOGY LIMITED, | ||
* BE REPRODUCED, COPIED, OR DISCLOSED TO A THIRD PARTY, OR | ||
* USED FOR ANY PURPOSE WHATSOEVER, OR STORED IN A RETRIEVAL SYSTEM | ||
* EXCEPT AS ALLOWED BY THE TERMS OF SEAGATE LICENSES AND AGREEMENTS. | ||
* | ||
* YOU SHOULD HAVE RECEIVED A COPY OF SEAGATE'S LICENSE ALONG WITH | ||
* THIS RELEASE. IF NOT PLEASE CONTACT A SEAGATE REPRESENTATIVE | ||
* http://www.xyratex.com/contact | ||
* | ||
* Original author: Ganesan Umanesan <[email protected]> | ||
* Original creation date: 18-May-2020 | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
#include <unistd.h> | ||
#include <pthread.h> | ||
|
||
/* | ||
****************************************************************************** | ||
* GLOBAL VARIABLES | ||
****************************************************************************** | ||
*/ | ||
int qos_total_weight=0; /* total bytes read or written */ | ||
pthread_mutex_t qos_lock; /* lock qos_total_weight */ | ||
|
||
/* | ||
****************************************************************************** | ||
* STATIC FUNCTION PROTOTYPES | ||
****************************************************************************** | ||
*/ | ||
static int qos_print_bw(void); | ||
|
||
|
||
|
||
/* | ||
****************************************************************************** | ||
* EXTERN FUNCTIONS | ||
****************************************************************************** | ||
*/ | ||
|
||
/* | ||
* disp_realtime_bw() | ||
* thread function that displays real-time | ||
* bandwidth | ||
*/ | ||
void *disp_realtime_bw(void *arg) | ||
{ | ||
while(1) | ||
{ | ||
qos_print_bw(); | ||
sleep(1); | ||
} | ||
return 0; | ||
} | ||
|
||
/* | ||
****************************************************************************** | ||
* STATIC FUNCTIONS | ||
****************************************************************************** | ||
*/ | ||
|
||
/* | ||
* qos_print_bw() | ||
*/ | ||
static int qos_print_bw(void) | ||
{ | ||
double bw=0; | ||
bw=(double)qos_total_weight/1000000; | ||
/* reset total weight */ | ||
pthread_mutex_lock(&qos_lock); | ||
qos_total_weight=0; | ||
pthread_mutex_unlock(&qos_lock); | ||
printf("bw = %06.3f MB/s\n",bw); | ||
return 0; | ||
} | ||
|
||
/* | ||
* Local variables: | ||
* c-indentation-style: "K&R" | ||
* c-basic-offset: 8 | ||
* tab-width: 8 | ||
* fill-column: 80 | ||
* scroll-step: 1 | ||
* End: | ||
*/ |