Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
9dba726e
Unverified
Commit
9dba726e
authored
Dec 06, 2016
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: account for different architectures
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
862722a2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
19 deletions
+19
-19
lxc_top.c
src/lxc/tools/lxc_top.c
+19
-19
No files found.
src/lxc/tools/lxc_top.c
View file @
9dba726e
...
@@ -21,11 +21,14 @@
...
@@ -21,11 +21,14 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
*/
#define __STDC_FORMAT_MACROS
/* Required for PRIu64 to work. */
#include <errno.h>
#include <errno.h>
#include <inttypes.h>
#include <signal.h>
#include <signal.h>
#include <stdbool.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <stdint.h>
#include <termios.h>
#include <termios.h>
#include <unistd.h>
#include <unistd.h>
#include <sys/epoll.h>
#include <sys/epoll.h>
...
@@ -318,11 +321,11 @@ static void stats_print(const char *name, const struct stats *stats,
...
@@ -318,11 +321,11 @@ static void stats_print(const char *name, const struct stats *stats,
char
kmem_used_str
[
20
];
char
kmem_used_str
[
20
];
struct
timeval
time_val
;
struct
timeval
time_val
;
unsigned
long
long
time_ms
;
unsigned
long
long
time_ms
;
if
(
!
batch
)
{
if
(
!
batch
)
{
size_humanize
(
stats
->
blkio
,
blkio_str
,
sizeof
(
blkio_str
));
size_humanize
(
stats
->
blkio
,
blkio_str
,
sizeof
(
blkio_str
));
size_humanize
(
stats
->
mem_used
,
mem_used_str
,
sizeof
(
mem_used_str
));
size_humanize
(
stats
->
mem_used
,
mem_used_str
,
sizeof
(
mem_used_str
));
printf
(
"%-18.18s %12.2f %12.2f %12.2f %14s %10s"
,
printf
(
"%-18.18s %12.2f %12.2f %12.2f %14s %10s"
,
name
,
name
,
(
float
)
stats
->
cpu_use_nanos
/
1000000000
,
(
float
)
stats
->
cpu_use_nanos
/
1000000000
,
...
@@ -335,20 +338,17 @@ static void stats_print(const char *name, const struct stats *stats,
...
@@ -335,20 +338,17 @@ static void stats_print(const char *name, const struct stats *stats,
printf
(
" %10s"
,
kmem_used_str
);
printf
(
" %10s"
,
kmem_used_str
);
}
}
}
else
{
}
else
{
gettimeofday
(
&
time_val
,
NULL
);
gettimeofday
(
&
time_val
,
NULL
);
time_ms
=
(
unsigned
long
long
)
(
time_val
.
tv_sec
)
*
1000
+
(
unsigned
long
long
)
(
time_val
.
tv_usec
)
/
1000
;
time_ms
=
(
unsigned
long
long
)
(
time_val
.
tv_sec
)
*
1000
+
(
unsigned
long
long
)
(
time_val
.
tv_usec
)
/
1000
;
printf
(
"%llu,%s,%lu,%lu,%lu,%lu,%lu,%lu,%lu"
,
printf
(
"%"
PRIu64
",%s,%"
PRIu64
",%"
PRIu64
",%"
PRIu64
time_ms
,
",%"
PRIu64
",%"
PRIu64
",%"
PRIu64
",%"
PRIu64
,
name
,
(
uint64_t
)
time_ms
,
name
,
(
uint64_t
)
stats
->
cpu_use_nanos
,
stats
->
cpu_use_nanos
,
(
uint64_t
)
stats
->
cpu_use_sys
,
stats
->
cpu_use_sys
,
(
uint64_t
)
stats
->
cpu_use_user
,
(
uint64_t
)
stats
->
blkio
,
stats
->
cpu_use_user
,
(
uint64_t
)
stats
->
blkio_iops
,
(
uint64_t
)
stats
->
mem_used
,
stats
->
blkio
,
(
uint64_t
)
stats
->
kmem_used
);
stats
->
blkio_iops
,
stats
->
mem_used
,
stats
->
kmem_used
);
}
}
}
}
static
int
cmp_name
(
const
void
*
sct1
,
const
void
*
sct2
)
static
int
cmp_name
(
const
void
*
sct1
,
const
void
*
sct2
)
...
@@ -457,7 +457,7 @@ int main(int argc, char *argv[])
...
@@ -457,7 +457,7 @@ int main(int argc, char *argv[])
struct
lxc_epoll_descr
descr
;
struct
lxc_epoll_descr
descr
;
int
ret
,
ct_print_cnt
;
int
ret
,
ct_print_cnt
;
char
in_char
;
char
in_char
;
ret
=
EXIT_FAILURE
;
ret
=
EXIT_FAILURE
;
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
if
(
lxc_arguments_parse
(
&
my_args
,
argc
,
argv
))
goto
out
;
goto
out
;
...
@@ -491,7 +491,7 @@ int main(int argc, char *argv[])
...
@@ -491,7 +491,7 @@ int main(int argc, char *argv[])
if
(
batch
)
{
if
(
batch
)
{
printf
(
"time_ms,container,cpu_nanos,cpu_sys_userhz,cpu_user_userhz,blkio_bytes,blkio_iops,mem_used_bytes,kernel_mem_used_bytes
\n
"
);
printf
(
"time_ms,container,cpu_nanos,cpu_sys_userhz,cpu_user_userhz,blkio_bytes,blkio_iops,mem_used_bytes,kernel_mem_used_bytes
\n
"
);
}
}
for
(;;)
{
for
(;;)
{
struct
lxc_container
**
active
;
struct
lxc_container
**
active
;
int
i
,
active_cnt
;
int
i
,
active_cnt
;
...
@@ -520,12 +520,12 @@ int main(int argc, char *argv[])
...
@@ -520,12 +520,12 @@ int main(int argc, char *argv[])
stats_print
(
total_name
,
&
total
,
&
total
);
stats_print
(
total_name
,
&
total
,
&
total
);
}
}
fflush
(
stdout
);
fflush
(
stdout
);
for
(
i
=
0
;
i
<
active_cnt
;
i
++
)
{
for
(
i
=
0
;
i
<
active_cnt
;
i
++
)
{
lxc_container_put
(
ct
[
i
].
c
);
lxc_container_put
(
ct
[
i
].
c
);
ct
[
i
].
c
=
NULL
;
ct
[
i
].
c
=
NULL
;
}
}
in_char
=
'\0'
;
in_char
=
'\0'
;
if
(
!
batch
)
{
if
(
!
batch
)
{
ret
=
lxc_mainloop
(
&
descr
,
1000
*
delay
);
ret
=
lxc_mainloop
(
&
descr
,
1000
*
delay
);
...
@@ -551,7 +551,7 @@ int main(int argc, char *argv[])
...
@@ -551,7 +551,7 @@ int main(int argc, char *argv[])
}
}
}
}
ret
=
EXIT_SUCCESS
;
ret
=
EXIT_SUCCESS
;
err1:
err1:
lxc_mainloop_close
(
&
descr
);
lxc_mainloop_close
(
&
descr
);
out:
out:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment