C++ :: Monitor Cpu Usage While App Is Running

Jul 15, 2012

I am working on a parallel processing server/client app with a multi-threaded server and several data processing clients, each their own process. I am trying to optimize some of the parameters, such as the size of the chunks that are read, processed, and output, and also some of the timeout values and such. I can track the time to finish a given task well enough, but it would be really nice to be able to track the cpu use. When CPU use is near 100% (on all cores) for the entire run, that is a good sign. I have noticed that with some combinations of parameters, CPU drops quite a bit for long stretches, which is not such a good sign. This app process large input files (2.5GB-65GB so far) and needs to be stable for long periods of time.

Other than sitting and staring at the task manager all day, is there a good way to track/log the CPU usage over runs that take many hours? I know that there are some apps like Everest that chart CPU use, but it would be nice to have something that would write to the same log file I am already using for other program output.

View 1 Replies


ADVERTISEMENT

C# :: How To Get Monitor Out Of Sleep Mode

Jul 12, 2012

How can you get a monitor out of sleep mode in c#?

I tried the following, but then the monitor wakes up and falls back to sleep mode immediately.

Code:

uint SC_MONITORPOWER = 0xF170;
uint WM_SYSCOMMAND = 0x0112;
SendMessage(this.Handle, WM_SYSCOMMAND,
(IntPtr)SC_MONITORPOWER, (IntPtr)(-1));

View 1 Replies View Related

C# :: How To Monitor Registry File / Key Changes

Jan 13, 2014

I am developing an application which monitors file changes and also registry key changes during a driver installation. I have used this code from internet, but doesn't works.

public void WmiChangeEventTester() {
try {
WqlEventQuery query = new WqlEventQuery(
"SELECT * FROM RegistryValueChangeEvent WHERE " +
"Hive = 'HKEY_LOCAL_MACHINE'" +
@"AND KeyPath = 'SOFTWARESchneider ElectricDMODBUS' AND ValueName='CurrentVersion'");

[Code] ....

View 7 Replies View Related

C++ :: Read From File And Display On Monitor In Reverse Order

Nov 5, 2013

works fine without the for loop.... if i use for loop...it doesnt give the output...

Code: #include<iostream>
#include<conio.h>
#include<fstream>

[Code]....

View 3 Replies View Related

C :: Dragon Board Serial Monitor Programming Menu

Apr 2, 2014

I am working on my senior project and my currect task is to make a menu. I dont know what the best way to do it. my code is not complete and i am completely lost. code found below:

Code:

#include <hidef.h> /* common defines and macros */#include "derivative.h" /* derivative-specific definitions */
#include "lcd.h"
#include<menu.h>
void main(void) {
char *msg1 = "Menu";

[code].....

View 4 Replies View Related

C/C++ :: Input Hex Number / Convert To Char And Display To Monitor

Sep 9, 2014

What I'm trying to do is have the user input a hex number this number will then be converted to a char and displayed to the monitor this will continue until an EOF is encountered.I have the opposite of this code done which converts a char to a hex number. The problem I'm running into is how do i get a hex number from the user I used getchar() for the char2hex program. Is there any similar function for hex numbers?

this is the code for the char2hex program

#include <stdio.h>
int main(void) {
char myChar;
int counter = 0;
while(EOF != (myChar = getchar())) {
if (myChar == '')

[Code] .....

This is what i want to the program to do except it would do this continuously

#include<stdio.h>
int main() {
char myChar;
printf("Enter any hex number: ");
scanf("%x",&myChar);
printf("Equivalent Char is: %c",myChar);
system("pause");
return 0;
}

View 1 Replies View Related

Visual C++ :: Moving Mouse Cursor To Certain Colors On Monitor

Apr 22, 2013

I am currently starting to attempt to make a program that can move my cursor to certain colors on my monitor. The problem is this seems like it will be 10x harder than I first thought.

View 4 Replies View Related

C# :: Creating Service To Monitor And Read Contents Of File From A Folder

Feb 10, 2015

am trying to create a service that will try to create a service that will monitor a folder. Whenever a new file gets created, I am trying to read the contents of new file and copy contents (with same file) at a new location.

The problem I am facing is that only first file that gets its name copied and a file created at a new location, but without any contents. The subsequent files do not get created at all.

My Services.cs looks like this:-

public partial class Service1 : ServiceBase
{
public Service1()
{

[Code]....

View 7 Replies View Related

C :: Static Variable Usage

Dec 27, 2013

I was exploring static variable by writing code snippets. I tried below code and it ended up throwing error saying "error: storage class specified for parameter 'b'"

Why static cannot be used in func() ?

Code:
int main() {
int a;
a=5;
func(a);
printf("%d",a);
return 0; }

void func(static int b)
{b=6;
printf("%d",b); }

View 7 Replies View Related

C :: Vector Usage In Codes

Sep 19, 2014

Now i am utilizing vectors in my codes.If i want to make a vector and i use #define to put a limit on the amount of variables it can contain. Until now i can do that. But let's suppose that i put 40 variables as its max capacity, but an user just needs to use only 12 or 14 variables. Put a rule that if someone has finished inserting his data and he is yet to fill the whole capacity of the vector the code.As to say : "If case you want to end press 0" .Edited : My computer has windows 7 and i took Codeblocks as my editor.

View 2 Replies View Related

C++ :: Check CPU / RAM USAGE / Temperature

Nov 1, 2014

I want to make an application that will check CPU/RAM USAGE and CPU TEMPERATURE and if it meets some requirements it will restart your system or do something else..but my problem is:

1) How do i get that info? (i know that in VB.net there is an easy way) but in C/C++ or Java?

2) Is it possible though a C program to execute a command and parse that info to your program?

I am mainly interested for windows but i need also info for linux too..

View 4 Replies View Related

C :: Detect CPU Usage And Free RAM On Windows X86 In C?

Feb 20, 2015

I don't use Visual Studio and/or C++ so I would like to do it without them. I found this article c++ - How to determine CPU and memory consumption from inside a process? - Stack Overflow

I tried some lines of code but no one works for me.

Code:

#include "windows.h"
typedef struct _MEMORYSTATUSEX {
DWORD dwLength;

[Code]....

These was just my first tries to work with da MEMORYSTATUSEX.

I would like to find out if there is free memory at least ... (some value) and similar.

View 1 Replies View Related

C++ :: Memory Usage And Algorithm Efficiency?

Jan 27, 2013

How can I check how much memory my program is using? I have an assignment which asks me to make sure I'm not exceeding some amount of memory but I don't know how I'd do that on Windows 7.

Also, my program parses through a text file and puts each word in a vector so that I can later go through the vector and "locate" where the nth occurrence of a word is by keeping track of a counter and incrementing the counter each time I see the word in the vector. Is this a vector a bad data structure for this? I'm aiming at keeping the efficiency at less than O(n^2).

View 9 Replies View Related

Visual C++ :: Get Maximum Memory Usage Of App?

Apr 21, 2013

I use Visual C++ to write a native C++ application. How to know the maximum memory it will use during its execution?

View 5 Replies View Related

Visual C++ :: Usage Of Critical Section

Dec 11, 2012

I am using a thread in my application .. A DLL is written for In and Out instructions for hardware ICS and to read FIFO.

My code is

CCriticalSection crdll , crsec ;
UINT ThreadReceiveData(LPVOID param) {
for ( ; ; ) {
if (bTerminate) break; // bTerminate = 1 in Doc template destructor
crdll.Lock();

[Code] ....

I am confused , how and when I should use Ctitical Section ? The program works fine but I am not happy as this is main routine of the program and I have not understood it properly.

View 10 Replies View Related

C++ :: Simple Class Usage Compiler Error

May 12, 2013

Full disclosure: this is an exercise from "Sams Teach Yourself C++ in 24 Hours" by Jesse Liberty and Rogers Candenhead. This refers to Chapter 9 (Hour 9 Activity 1)

I created a class called Point, in Point.h

I created a class called Rectangle in Rectangle.h and Rectangle.cpp

If I create an int main() function in Rectangle.cpp (that includes Rectangle.h), I can compile Rectangle.cpp and run the resulting program. Fine.

Question:

I create a separate file called main.cpp. I include Rectangle.h. But now the compiler complains.

Code:
$ g++ main.cpp -o main
/tmp/cc38JIph.o: In function `main':
main.cpp:(.text+0x26): undefined reference to `Rectangle::Rectangle(int, int, int, int)'
main.cpp:(.text+0x32): undefined reference to `Rectangle::getArea() const'
collect2: ld returned 1 exit status If I can create a class in Point.h and use it in Rectangle.h, why can I not just use Rectangle in main.cpp?

And the files, of course:

file: main.cpp
Code:
#include <iostream>
#include "Rectangle.h"
using std::cout;
using std::endl;

[Code] .....

View 3 Replies View Related

C++ :: Array Char Rotation And Arrow Key Usage

Apr 27, 2013

I am doing a project for a class which involves making a game where there is an arrray that holds a player (you) and a zombie (comp). The player is suppose to be able to turn clockwise or counter clockwise, move forward, and backward and shoot. Im having trouble trying to rotate the char in an array. I am also trying to switch from using the W,S,D,A to the arrow keys but doesnt seem to work.

#include <iostream>
#include <windows.h>
#include "color.h"
using namespace std;
using namespace Petter;
const int COL = 15;
void initBoard(char[][COL], int, int);

[Code] ....

View 5 Replies View Related

C# :: High RAM Usage On Postback Caused By Datatable

Dec 23, 2014

I basically have a listbox that has postcode areas i.e : AE,CW,GU etc etc.

The user selects this and then a postback occurs - an sql statement is builts and a database query operation is performed and the results are returned to a datatable called tempdata.

So far so good. I then need to loop through this datatable and copy the records to my main viewstate datatable which is the datasource for google maps api.

DataTable tempstore = GetData(querystring, "");
//check tempstore has rows otherwise add defaultcust as default otherwise map will be blank
if (tempstore.Rows.Count == 0)
{

[Code].....

So my main datatable can grow and grow as users add more postcodes. However when it gets to around 500 rows or so I get a huge memory spike only on postback and then it settles back down.

My ram usage goes from 2gb to 3gb and if even more postcodes is selected it maxes the memory and crashes my pc.

If I remove the:

dtpc.Importrow(row);

the memory spike goes completely, obviously because the main datatable has no rows. I thought you only run into memory issues when you have thousands of rows?

View 1 Replies View Related

C++ :: Undefined Reference With Mingw (template Usage)

Apr 10, 2014

I am wondering why ToStr throws me this error. I am using mingw64 and codeblocks.

Code:

E:JackyDocumentsCode Blocks ProjectsPerfectSimXmain.cpp|35|undefined reference to `std::string ToStr<int>(int const&)'|

Code:
for (int i = 0; i < NO_CAMS; i++) {
std::string filename("E:/Jacky/Documents/Code Blocks Projects/PerfectSimX/Data/Cam");
std::string restFileName(".cam");
filename += ToStr(i);

[Code] ....

View 4 Replies View Related

C++ :: String Stream Usage To Parse The Line

Oct 7, 2012

I am working on a project were I have to read line form ( PLC ) programmable logic controller generated text file with lines like this

Circuit Value Current 2.33 4.32 5.55
there could be up to 3000 lines per txt file

I am using string stream to parse the line, for the sake of good programming I which to check weather first three values are string and last three values are actually floats raise or throw an exception if they are not ....

View 4 Replies View Related

Visual C++ :: MFC Proper Usage Of Sending Message To Dialog To Activate

Jan 7, 2015

I have finally got around to developing C++ & MFC using Visual Studio 2012, to build a full GUI Windows application (not sure if I have made the right choice). Though admittedly in two months time I do have a dialog window at my beck and call.

Now I have discovered a flaw (suspect) partially caused by the design of this program not all following the same principles, nor written by the same people and long predates me. Let describe the situation.

I have a dialog I have created as a class which has a combo box. The list of items are populate during the OnInitDialog() function just fine, except if the file where the detail is not yet read from that combo box would not have any items other than the default. This is to be expected in the use of the program, so fine.

However, if the dialog (modeless) was already open and active, when the user went up to and selected the menu command (main window) to read that file that CPtrList data structure that held that data would not populate that Combo box on my dialog.

So what I would like when I am done reading the files contents is to detect if my dialog is opened and if so send it a message to Activate (force a call to OnActivate()). I have gone to the event list for the dialog and exposed this event handler from the resource editor just fine.

I see the syntax of OnActivate() is

void MyClass::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimalized);

So nState is an Unsigned Int of the current state of the thread/window (not sure)?

CWnd* pWndOther is the CWnd of my other Window that wants my dialog to activate I think which is the main application since it was on the a menu that this function was called to read the file.

bMinimalized is whether my dialog is mimalized(?)

View 10 Replies View Related

C++ :: Colon Usage (single And Double) Member Initializer List?

Aug 27, 2013

The below code is taken from the open source 7zip project (7z920CPP7zipUIFileManagerBrowseDialog.h)

Code:
class CBrowseDialog: public NWindows::NControl::CModalDialog {

What does the single colon (CBrowseDialog:) mean? Is that Initializer List?

I know the double colon (NWindows::NControl::CModalDialog) is Scope Resolution Operator.

Why is (: public NWindows::NControl::CModalDialog) used with the class declaration?

Similar code is found through out the project along with class declarations.

View 2 Replies View Related

C++ :: Demonstrate Usage Of Each Member Function Using Test Data (width And Height)

Feb 11, 2013

Provide the definitions for the following class declaration and then write a program that demonstrates usage of each member function using the test data of 10 for width and 8 for height. Remember to put your main program, class header and class source into separate files. This is an easier version of the exercise than the one you have been asked to practice. Only provide code for the methods specified in the class declaration. Note that the displayRectangle() method should output an appropriate ‘box’, its dimensions, area and perimeter to the screen.

class Rectangle {
public:
Rectangle(int height, int width);
~Rectangle(void);

[Code] .....

View 1 Replies View Related

Visual C++ :: How To Reduce High CPU Usage Caused By Receiver Thread Of CAN Messages

Feb 13, 2013

I am writing a program which handles the CAN messages Received from BUS.My code is taking almost 60% of CPU usage.

View 14 Replies View Related

C++ :: Pointer Usage To Base Class Object In Vector Int Main Function

Aug 12, 2013

I know what are pointer's and how to use them but there is one point i am not able to understand. Below is the example code

I understand everything in the below code except 1 thing why i am using pointer to base class object in vector int the main() Function?

Code:
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
// base class

[Code] ...

Here is the lines of code i want to understand.

Code:
vector<Employee*> employees;
employees.push_back(&emp1);
employees.push_back(&mgr1);

I know if i will not use the pointer base class function "virtual double grossPay" will be called for both base class object and derived class object and when i will use pointer with reference to the object because base class function is virtual it will look for same function in derived class and if available it will execute it.

View 3 Replies View Related

C++ :: Memory Usage Of A Program With CLASS And Without CLASS?

Nov 6, 2014

I developing a C++ Program to deal with huge data computation. I am using Pointers to hold the data during computation. Current program i developed without using CLASS.

I would like to ask that will the memory usage will be reduced and computational time will be shortened if I modified my program implementing the CLASS into it ?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved