Hi, welcome to a new video on accessing statistics on both your CPU, RAM and hard disk to be able
to get these statistics via Python.
You need to use the PS YouTube library, so imports too.
And that's something you need to install because it's a full of the library, so people install PBS
YouTube if you're using repo for this.
Beware of that to the statistics you're going to get are those of the server where Apple is running
some of the Linux server.
If you're using your local ID, then what you get is your own computer.
Once you have it suits you.
We will start by accessing processor statistics.
So the CPU?
The library is very, very easy to use.
All we have to do is just refer to a few methods.
So you say CPU and then you have different methods here.
I'm going to show some of them.
So, for example, CPU, you can't.
We'll give you the number of coals on your CPU.
So 16, in my case.
And if you say logical equal to falls, well, that's we'll give you only the physical cores.
So eight next, if you want to know the current CPU usage as a percentage, you'd see PSU to the CPI
two percent.
And run.
We get zero because the time interval was zero.
So in order for this to work correctly, you need to give an interval of at least 0.1, but one second
is a good number.
So in that case, you give the current percentage your CPU is being used on your computer.
7.5 is, in my case, the higher this interval is, the more accurate the value will be.
So it gives you a better view of the percentage.
More about the CPU, you can use PSU to dodge CPU times.
Now this will give you a series of values, as you will see.
So these are the sections that the CPU has spent in given mode, so as a user or as the system, as
a kernel or it needs a mode to gets even more statistics, you can use YouTube.
That's CPU.
That's.
So that's the other trouble.
So these are named staples, if you really want to access one of these values, such as system for that
first step, all you do that system.
And that should give you only the system value, which is this in seconds.
So the time spent in seconds.
The same goes for the other CPU stocks, which we get from this method.
And lastly, about the CPU, I wanted to also show you the frequency or the CPU, which is that's.
So that will give you the frequency, the current frequency in megahertz and the minimum and the maximum
this will.
Next room.
So temporary memory of your computer, you can access of her own statistics using.
Virtual memory and see what's that gives us.
So it's that named to pull, you have total memory of your RAM, so the capacity of your RAM and that
is in bytes and that's the available also in bytes, that's a percentage used at the moment that we're
speaking in my computer.
So you have another series of statistics here about, you know, if you want to see the swap memory,
which is the memory that is used, whether RAM is full and the memories use from the hard disk than
you do.
So memory.
And that should be the loss results, that's a name to pull.
And lastly, your hard disk,
naturally, you want to know the usage of it, so this usage and expects a path.
In my case, it would be that homepage.
So run.
Vowels are the numbers in boys, there's a total size of my hard disk.
That's a used size as a free and as a percentage as well.
So again, if you want to just get one of them, such as percentage, you can say that's percent.
That's who gets that number.
Run and you get seventy one point nine.
You can also get the partitions using steel disk partitions.
In the form of a list with different items, depending on how many politicians you have.
For more information about all these parameters that you see here, you can go to this page, so that's
the official documentation of suits you.
You can also find this URL or touched in the lecture resources so you can just click it and it will
take you to the documentation that's above this lecture, presumably.
But maybe you need this.
So thank you.
I'll see you later.