# Creating a graph

## Recommended Posts

Hi,

I want to create a graph from the following data.

Garph1 BS

CPU Percentage 12
Memory Usage 15773696
sdiskusage total 9.82901E+11
sdiskusage used 1.41429E+11
sdisk usage free 7.91472E+11
sdisk usage percentage 15.2
virtual Memory 10234679296
Time 1.026669979

Graph2 SS

CPU Percentage 2
Memory Usage 15769600
sdiskusage total 9.82901E+11
sdiskusage used 1.41429E+11
sdisk usage free 7.91472E+11
sdisk usage percentage 15.2
virtual Memory 10545913856
Time 1.026956081

Graph3 BSBS

CPU Percentage 12
Memory Usage 15773696
sdiskusage total 9.82901E+11
sdiskusage used 1.41429E+11
sdisk usage free 7.91472E+11
sdisk usage percentage 15.2
virtual Memory 10234679296
Time 1.071877241

Problem with the attached graph is that its creating the same graph for all the 3 data. How can I create variation using decimal values?Also it is not considering time?

##### Share on other sites
Posted (edited)
10 hours ago, zak100 said:

Problem with the attached graph is that its creating the same graph for all the 3 data. How can I create variation using decimal values?

The data for the three graphs is nearly identical so the graphs will be nearly identical. Maybe it is better to have separate y-axis scale for the values; the small variations and small values are not visible.

10 hours ago, zak100 said:

Also it is not considering time?

When drawing a bar that has the height of approximately $10^{11}$ next to one that is approximately 1.0 the latter will not be visible since it is so small in comparison.

Edited by Ghideon

##### Share on other sites

It is a bit difficult since i am not sure what your goal is but here is some advice.

1.  Remove the 4 sdiskusage items from the 3 cases and put them in the graph title (since they are the same in all cases), something like "Comparison of CPU performance with a sdiscusage of total=bla bla, used= bla bla,  etc.

2.  for the virtual memory and the memory usage i would change them to megabytes a terabytes assuming that the numbers are bytes.

4.  change the time from sec to sec x 10

That should make all of the changing variable to th range of about 2 to 16 so you can see the differences easily.

Hope that helps or at least gives you some ideas.

##### Share on other sites
Posted (edited)
On 3/29/2020 at 5:37 PM, Bufofrog said:

2.  for the virtual memory and the memory usage i would change them to megabytes a terabytes assuming that the numbers are bytes.

It should be smarter than that. Pseudo code:

if mem >= 1e12 then printf( "%.1f TB", mem/1024/1024/1024/1024 )

else if mem >= 1e9 then printf( "%.1f GB", mem/1024/1024/1024 )

else if mem >= 1e6 then printf( "%.1f MB", mem/1024/1024 )

else ...

Also if we have fixed memory size, we could draw one continuous horizontal/vertical bar for both. Used memory in red color, free memory in green color.

Edited by Sensei

##### Share on other sites

Hi all,

@SenseiWhich language can I use for implementing this pseudo code?

Zulfi.

##### Share on other sites
Posted (edited)
4 minutes ago, zak100 said:

@SenseiWhich language can I use for implementing this pseudo code?

ANSI-C is the closest. Just change to if(....) printf(....); (semicolon at the end of line of code is required)

and add #include <stdio.h> at the beginning.

and cast type to float (because %f is used)

Edited by Sensei

##### Share on other sites

Sir,

very good idea. I would try this .

God bless you

Zulfi.

##### Share on other sites

The whole point of using pseudocode is to have it human readable and understandable and independent from the real computer language (which might be, and usually is, not self-explanatory). Read article:

## Create an account

Register a new account