Sunday, August 27, 2017

Digest for comp.lang.c++@googlegroups.com - 15 updates in 4 topics

kushal bhattacharya <bhattacharya.kushal4@gmail.com>: Aug 27 06:25AM -0700

Hi,
Is there any api function in c or c++ which can fetch cpu info showing system statistics individually if possible like cpu usage ,total ram ,free ram number of cpus etc?
Thanks
Markus Raab <usenet@markus-raab.org>: Aug 27 09:52PM +0200

Hi,
 
kushal bhattacharya wrote:
> Is there any api function in c or c++ which can fetch cpu info showing
> system statistics individually if possible like cpu usage ,total ram ,free
> ram number of cpus etc?
 
There is no portable way. On Linux, for RAM and CPUs:
 
long sysconf(int name), with name as:
 
 
- _SC_PHYS_PAGES
The number of pages of physical memory. Note that it is
possible for the product of this value and the value of _SC_PAGESIZE to
overflow.
 
- _SC_AVPHYS_PAGES
The number of currently available pages of physical memory.
 
- _SC_NPROCESSORS_CONF
The number of processors configured.
 
- _SC_NPROCESSORS_ONLN
The number of processors currently online (available)
 
should help.
 
For more stats you might need to parse /proc/loadavg and similar..
 
best regards,
Gareth Owen <gwowen@gmail.com>: Aug 27 09:11PM +0100

> Is there any api function in c or c++ which can fetch cpu info showing
> system statistics individually if possible like cpu usage ,total ram
> ,free ram number of cpus etc?
 
It's often easiest to read and parse the text output provided through
the /proc filesystem
 
/proc/meminfo will give you the RAM
/proc/cpuinfo will tell you about CPU numbers/speed etc
/proc/loadavg will give global system load
 
Per CPU stats are a bit trickier, but generally require reading
/proc/stat a few times
"Chris M. Thomasson" <invalid@invalid.invalid>: Aug 27 01:52PM -0700

On 8/27/2017 6:25 AM, kushal bhattacharya wrote:
> Hi,
> Is there any api function in c or c++ which can fetch cpu info showing system statistics individually if possible like cpu usage ,total ram ,free ram number of cpus etc?
> Thanks
 
You can get the number of cpus:
 
http://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency
 
It is very basic information, and not going to help wrt creating a
topographic map of NUMA nodes. We basically need some OS specific
information here.
Rod Pemberton <NeedNotReplyHere@xrsevnneqk.cem>: Aug 27 03:31AM -0400

On Sat, 26 Aug 2017 14:52:22 +0100
> difference to the fucktard Rick C. Hodgin because he knows nobody
> subscribes to that newsgroup and he like to post his off topic "God"
> nonsense posts to technical newsgroups such as this one.
 
While that is true, no one (not Flibble, not Vine, not Heathfield, not
Schmakov) apparently noticed that Rick /DID/ mark this thread off-topic
(OT) as "required" by Usenet etiquette. (These are not Google
Groups.) None of you had to read it once you saw the OT. None of
you should of read it once you saw the OT. None of you had to respond
to it once you saw it. All of you could've filtered out the entire
thread by filtering for "OT" in your newsreader.
 
Rick is a good guy, as long as he stays off religion.
 
I also take issue with all of you attacking me for replying, when some
of you also did so too, when you should've taken issue with Rick, if
anyone, early on in the thread, instead of waiting, then attacking me
later on. That was low and dirty. So, put the blame where it belongs,
where it originated. That was with Rick. So, just as Healthfield has
stepped to a brand new low by stealing the trademark insult of a dead
c.l.c. regular CBFalconer, I also do so to all of you who so wrongly
attacked me for conversing with Rick in a thread so /clearly/ marked as
off-topic:
 
**PLONK**
 
 
Rod Pemberton
--
Isn't anti-hate just hate by another name? Isn't
anti-protesting just protesting by another name?
Peace is a choice that both sides rejected.
krister alm <krister.alm@gmail.com>: Aug 27 12:51AM -0700

"Jesus died for your sins"
Except he didn't actually STAY died.
So what did he sacrifice?
His weekend?
 
Jesus gave up his weekend for your sin.
 
Strange how you can believe in Jesus and God but not Santa Clause, tooth fairy and all other fairy-tales.
 
Time to boot up your own brain and use it for actual thinking.
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Aug 27 09:43AM -0500

> I am teaching. I am willing to entertain questions, and correct the
> mistakes made by people who reply in error.
 
> It is not preaching. It is teaching. And they are different.
 
If you were teaching us we would be learning something and yet we already
know everything you preach to us to be false so it seems that it is you
that needs to learn something.
 
/Flibble
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Aug 27 08:44AM -0700

On Sunday, August 27, 2017 at 10:43:33 AM UTC-4, Mr Flibble wrote:
> Rick C. Hodgin <rick.c.hodgin@gmail.com> wrote:
> > It is not preaching. It is teaching. And they are different.
 
> If you were teaching us we would be learning something...
 
Why don't you learn from my teachings, Leigh?
 
"tl;dr"
 
The truth passes you by because you flatly deny it. That is
why you don't learn. You won't even give truth the time of
day, so you fail to learn not because His teaching isn't there,
but because you aren't there.
 
I've given you demonstration that Jesus was a man of history,
He was called Christ 2000 years ago, and that archaeologists
have found many things in the last 100+ years which have
confirmed the thing stated in the Bible. You refused to hear
them.
 
I've given you demonstration regarding the complexity of DNA,
and that it is so complex it could not possibly have come about
through evolutionary processes. You refused to hear them.
 
You do not show up to class, Leigh. It's why you don't learn.
 
Thank you,
Rick C. Hodgin
"Rick C. Hodgin" <rick.c.hodgin@gmail.com>: Aug 27 08:54AM -0700

On Sunday, August 27, 2017 at 3:52:08 AM UTC-4, krister alm wrote:
> So what did he sacrifice?
> His weekend?
 
> Jesus gave up his weekend for your sin.
 
We're going to find out once we leave this world and are able to
see and understand what He went through to pay the price of our
sin. We learn from the Bible that at the cross our sin was transferred
to Him, but that He later commended His Spirit unto the Father. We are
also taught that when Jesus gave up the Ghost He let out a loud cry.
 
I believe that gives us a hint of the real torment and agony that He
went through to pay the price of our sin after having died bearing it
all.
 
Every knee shall bow, and every tongue confess that Jesus Christ is
Lord, and all to the glory of God the Father. I believe this will
be a willing bowing of the knee, because even those who denied Jesus
here on this Earth will then see with their own eyes what it was He
endured to save us from sin.
 
I think it will prompt within them such reverence and respect that
they could do no other than bow down before Him, weeping and gnashing
their teeth that they did not come to a God who would endure such as
that which He endured to save us.
 
> Strange how you can believe in Jesus and God but not Santa Clause,
> tooth fairy and all other fairy-tales.
 
It's because Jesus is not a fairy tale.
 
> Time to boot up your own brain and use it for actual thinking.
 
There are two aspects to our existence. The one we're born with,
which is our flesh-based reasoning mind. But there is also spirit.
The spirit is what we are given when we come to Jesus and ask Him
to forgive our sin. That spiritual input gives us the ability to
know and discern things our flesh cannot.
 
It is from within that spiritual input that born again Christians
operate, which is why it seems like sheer foolishness to those who
are not yet born again.
 
The way to be born again is to acknowledge you are a sinner, and
to go to Jesus and ask forgiveness for your sin. If you do this
with sincerity, as a real inner driving need, then you will be
saved, and you will be born again in that selfsame instant, and
it will change your life forever.
 
It's why the song Amazing Grace has these words:
 
I once was lost, but now am found.
Was blind, but now I see.
 
You can't see the truth about God's Kingdom until you have those
new eyes to see (John 6:44), and that's something only God can
do for you. But for all who are born again, they will see the
Kingdom of Heaven through that spiritual change, and they will
then make decisions from the new things that new source of input
allows them to know.
 
All who come to faith in Christ will see the change, and will
move from the "That doesn't make any sense, Rick" camp, to the
"Ah yes! I see it now. It's so obvious!" camp.
 
Thank you,
Rick C. Hodgin
David Brown <david.brown@hesbynett.no>: Aug 27 07:03PM +0200

On 27/08/17 09:31, Rod Pemberton wrote:
> you should of read it once you saw the OT. None of you had to respond
> to it once you saw it. All of you could've filtered out the entire
> thread by filtering for "OT" in your newsreader.
 
I have a few points for you here, Rod, that might help you see where
people are coming from here.
 
First, you don't post with a valid email address - I would have emailed
if you had. Sometimes email is a better medium than a public newsgroup,
and it is why many regulars in c.l.c and c.l.c++ use valid addresses.
(That includes Rick, and Richard, and with a small obvious fix, Chris
and Mr. Flibble. I haven't checked everyone in this thread.)
 
Certainly marking a topic OT is better than having an unmarked off-topic
thread. However, merely marking it OT does /not/ make it appropriate
for a given newsgroup. That depends on the newsgroup and the
preferences of the people that make up that group. In some groups, like
sci.electronics.design, on-topic threads are by far the minority
compared to politics and other topics. In c.l.c. in particular, the
regulars are very keen to stay on topic, and there are many who strongly
dislike OT threads. In particular, there is massive dislike for the
religious threads which Rick regularly starts.
 
When you come from the outside, I can well appreciate that you don't
know this about c.l.c. - that group is fussier than many other groups in
this respect. Personally, I think it is healthy for a newsgroup to have
a small proportion of OT threads - as long as it is possible to keep
them to a small proportion. However, that possibility has been ruined
in c.l.c., by Rick and his incessant religious posts. There are several
regulars in c.l.c., including me, who enjoy a good discussion in such OT
threads - but decline to take part (except for the occasional post on
topicality, which is always on topic) from respect for the group
preferences.
 
And I also agree with you that people who are bothered by threads like
this should learn to use the "ignore thread" button on their newsreader.
It is not hard. However, I also fully appreciate that they want a
newsgroup where they don't have to actively ignore a substantial part of
the traffic.
 
 
 
> Rick is a good guy, as long as he stays off religion.
 
I try hard to hold that attitude, but Rick makes it impossible. I would
prefer to be able to discuss technical posts with him like anyone else
and ignore his off-topic posts. But Rick simply does not see it that
way - he sees his religious posts as being of paramount importance, and
cannot separate them from his technical posts. Even when he does make
purely technical posts, he is heavily influenced by his fanaticism (for
example, he won't read the advice or suggestions I give him in technical
matters, because he believes I am possessed by the devil). And you will
notice that he does not discuss religious matters either - he
pontificates, links to youtube videos, and regurgitates the same set
answers repeatedly. You will not succeed in making him think - I have
tried and failed too.
 
> attacked me for conversing with Rick in a thread so /clearly/ marked as
> off-topic:
 
> **PLONK**
 
People in c.l.c. know there is no point in trying to reason with Rick
about his religious posts - it is a complete waste of time, and results
in more meaningless noise. Sometimes it is worth trying to make other
people understand the effect of their posts - it may lead to a change of
behaviour. Thus in any thread where people are responding to Rick and
encouraging threads like this, it is the other people who are asked to stop.
 
I am deliberately not taking sides or judging here, or trying to say who
acted badly, or who is at fault - or even what faults might have been
committed. I am just trying to give you some background and other
points of view.
 
I'd also suggest that if you are interested in technical discussions on
c.l.c., you might have "plonked" some useful contributors here.
"wolfgang kern" <nowhere@never.at>: Aug 27 07:28PM +0200

David Brown replied to Rod Pemberton:
...
(I'm a long term AOD reader/poster)
 
I know Rick since several decades, and he once was a logical oriented
low level coder with a lot of knowledge about CPU internals.
 
But meanwhile something happened in his private life which made him
more than mad and a fanantic religious nerd.
 
I'm really sorry for I had to ban all his posts for not seeing this
sad change at all. And he doesn't listen anymore to former friends.
So I can't see his posts, but I see all your replies to it.
__
wolfgang
Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk>: Aug 27 06:42PM +0100

On 27/08/2017 16:44, Rick C. Hodgin wrote:
> and that it is so complex it could not possibly have come about
> through evolutionary processes. You refused to hear them.
 
> You do not show up to class, Leigh. It's why you don't learn.
 
My analysis tells me that you have absolutely nothing to teach me
WHATSOEVER about ANYTHING.
 
You could be an interesting research project into how obtuse it is
possible for a Hominidae of average intelligence can possibly be. The
only value of the vomit you spew on Usenet could be input data for a
deliberately annoying Christ bot.
 
/Flibble
"Chris M. Thomasson" <invalid@invalid.invalid>: Aug 27 11:59AM -0700

On 8/24/2017 5:20 AM, Rick C. Hodgin wrote:
[...]
> which build up to assemblies / machines, which build up to factories
> of all kinds (biological, mechanical, industrial), which build up
> to provide grander constructs.
 
Humm... Sounds a bit fractal in nature to me. ;^)
ram@zedat.fu-berlin.de (Stefan Ram): Aug 27 06:30PM

>Is there any api function in c or c++ which can fetch cpu
>info showing system statistics individually if possible like
>cpu usage ,total ram ,free ram number of cpus etc?
 
Not in the standard library.
 
But operating systems often provide means. E.g.,
 
msdn.microsoft.com/en-us/library/windows/hardware/jj679884.aspx
 
. The means of the OS usually can be used from C
in more or less complicated ways.
kushal bhattacharya <bhattacharya.kushal4@gmail.com>: Aug 27 05:19AM -0700

On Thursday, August 24, 2017 at 11:08:54 PM UTC+5:30, red floyd wrote:
 
> > but its a facilty of c++ too i guess.I am mainly concerned about dumping the abort message from the program to my own custom file .
 
> The ISO standard does not discuss it. You yourself have said it's
> generated by the OS. Therefore by definition, it's out of scope here.
 
Actually i want to use that from a c++ program itself so i really want some pointers here :-( since i am not getting any clue from my end
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: