1
00:00:02,220 --> 00:00:12,150
Hi, welcome to a new video on accessing statistics on both your CPU, RAM and hard disk to be able

2
00:00:12,150 --> 00:00:14,800
to get these statistics via Python.

3
00:00:14,820 --> 00:00:20,890
You need to use the PS YouTube library, so imports too.

4
00:00:21,510 --> 00:00:27,750
And that's something you need to install because it's a full of the library, so people install PBS

5
00:00:27,750 --> 00:00:31,050
YouTube if you're using repo for this.

6
00:00:31,080 --> 00:00:38,040
Beware of that to the statistics you're going to get are those of the server where Apple is running

7
00:00:38,610 --> 00:00:39,990
some of the Linux server.

8
00:00:40,500 --> 00:00:45,150
If you're using your local ID, then what you get is your own computer.

9
00:00:46,800 --> 00:00:49,740
Once you have it suits you.

10
00:00:50,040 --> 00:00:53,700
We will start by accessing processor statistics.

11
00:00:54,000 --> 00:00:55,590
So the CPU?

12
00:00:58,620 --> 00:01:00,700
The library is very, very easy to use.

13
00:01:00,720 --> 00:01:04,500
All we have to do is just refer to a few methods.

14
00:01:05,310 --> 00:01:08,820
So you say CPU and then you have different methods here.

15
00:01:09,180 --> 00:01:11,070
I'm going to show some of them.

16
00:01:11,310 --> 00:01:13,340
So, for example, CPU, you can't.

17
00:01:13,960 --> 00:01:21,450
We'll give you the number of coals on your CPU.

18
00:01:21,490 --> 00:01:23,190
So 16, in my case.

19
00:01:24,570 --> 00:01:30,060
And if you say logical equal to falls, well, that's we'll give you only the physical cores.

20
00:01:31,170 --> 00:01:43,410
So eight next, if you want to know the current CPU usage as a percentage, you'd see PSU to the CPI

21
00:01:43,440 --> 00:01:44,970
two percent.

22
00:01:46,480 --> 00:01:47,170
And run.

23
00:01:49,120 --> 00:01:53,110
We get zero because the time interval was zero.

24
00:01:53,290 --> 00:02:00,490
So in order for this to work correctly, you need to give an interval of at least 0.1, but one second

25
00:02:00,490 --> 00:02:02,380
is a good number.

26
00:02:02,680 --> 00:02:08,289
So in that case, you give the current percentage your CPU is being used on your computer.

27
00:02:08,710 --> 00:02:16,210
7.5 is, in my case, the higher this interval is, the more accurate the value will be.

28
00:02:16,780 --> 00:02:20,530
So it gives you a better view of the percentage.

29
00:02:22,830 --> 00:02:29,550
More about the CPU, you can use PSU to dodge CPU times.

30
00:02:29,820 --> 00:02:35,910
Now this will give you a series of values, as you will see.

31
00:02:37,700 --> 00:02:46,660
So these are the sections that the CPU has spent in given mode, so as a user or as the system, as

32
00:02:46,670 --> 00:02:54,860
a kernel or it needs a mode to gets even more statistics, you can use YouTube.

33
00:02:54,860 --> 00:02:56,240
That's CPU.

34
00:02:56,540 --> 00:02:57,110
That's.

35
00:03:00,530 --> 00:03:03,470
So that's the other trouble.

36
00:03:03,650 --> 00:03:12,590
So these are named staples, if you really want to access one of these values, such as system for that

37
00:03:12,590 --> 00:03:14,630
first step, all you do that system.

38
00:03:15,500 --> 00:03:20,330
And that should give you only the system value, which is this in seconds.

39
00:03:20,570 --> 00:03:22,310
So the time spent in seconds.

40
00:03:23,570 --> 00:03:28,550
The same goes for the other CPU stocks, which we get from this method.

41
00:03:30,020 --> 00:03:37,250
And lastly, about the CPU, I wanted to also show you the frequency or the CPU, which is that's.

42
00:03:40,730 --> 00:03:47,000
So that will give you the frequency, the current frequency in megahertz and the minimum and the maximum

43
00:03:47,000 --> 00:03:47,450
this will.

44
00:03:49,510 --> 00:03:50,740
Next room.

45
00:03:53,510 --> 00:04:02,510
So temporary memory of your computer, you can access of her own statistics using.

46
00:04:04,320 --> 00:04:08,460
Virtual memory and see what's that gives us.

47
00:04:09,840 --> 00:04:18,149
So it's that named to pull, you have total memory of your RAM, so the capacity of your RAM and that

48
00:04:18,149 --> 00:04:25,560
is in bytes and that's the available also in bytes, that's a percentage used at the moment that we're

49
00:04:25,560 --> 00:04:27,840
speaking in my computer.

50
00:04:28,950 --> 00:04:37,560
So you have another series of statistics here about, you know, if you want to see the swap memory,

51
00:04:37,950 --> 00:04:45,900
which is the memory that is used, whether RAM is full and the memories use from the hard disk than

52
00:04:45,900 --> 00:04:46,590
you do.

53
00:04:47,310 --> 00:04:48,360
So memory.

54
00:04:50,160 --> 00:04:53,470
And that should be the loss results, that's a name to pull.

55
00:04:55,180 --> 00:04:58,930
And lastly, your hard disk,

56
00:05:02,080 --> 00:05:10,480
naturally, you want to know the usage of it, so this usage and expects a path.

57
00:05:10,510 --> 00:05:12,520
In my case, it would be that homepage.

58
00:05:12,970 --> 00:05:13,510
So run.

59
00:05:15,480 --> 00:05:21,840
Vowels are the numbers in boys, there's a total size of my hard disk.

60
00:05:22,110 --> 00:05:26,340
That's a used size as a free and as a percentage as well.

61
00:05:26,580 --> 00:05:31,940
So again, if you want to just get one of them, such as percentage, you can say that's percent.

62
00:05:31,950 --> 00:05:33,180
That's who gets that number.

63
00:05:33,990 --> 00:05:37,950
Run and you get seventy one point nine.

64
00:05:40,920 --> 00:05:48,960
You can also get the partitions using steel disk partitions.

65
00:05:54,560 --> 00:06:00,560
In the form of a list with different items, depending on how many politicians you have.

66
00:06:02,820 --> 00:06:10,680
For more information about all these parameters that you see here, you can go to this page, so that's

67
00:06:10,680 --> 00:06:14,310
the official documentation of suits you.

68
00:06:14,310 --> 00:06:19,640
You can also find this URL or touched in the lecture resources so you can just click it and it will

69
00:06:19,650 --> 00:06:24,660
take you to the documentation that's above this lecture, presumably.

70
00:06:24,720 --> 00:06:26,040
But maybe you need this.

71
00:06:26,430 --> 00:06:27,060
So thank you.

72
00:06:27,060 --> 00:06:27,840
I'll see you later.

