Running Linux phần 9

Tham khảo tài liệu 'running linux phần 9', ngoại ngữ, ngữ pháp tiếng anh phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 14. Tools for Programmers respective running times rounding them to the nearest hundredth of a second . In order to get good profiling information you may need to run your program under unusual circumstances for example giving it an unusually large data set to churn on as in the previous example. If gprof is more than you need calls is a program that displays a tree of all function calls in your C source code. This can be useful to either generate an index of all called functions or produce a high-level hierarchical report of the structure of a program. Use of calls is simple you tell it the names of the source files to map out and a function-call tree is displayed. For example papaya calls 1 levell 2 getid 3 getc 4 eatwhite 5 getc 6 ungetc 7 strcmp 8 eatwhite see line 4 9 balance 10 eatwhite see line 4 By default calls lists only one instance of each called function at each level of the tree so that ifprintf is called five times in a given function it is listed only once . The -a switch prints all instances. calls has several other options as well using calls -h gives you a summary. Using strace strace is a tool that displays the system calls being executed by a running This can be extremely useful for real-time monitoring of a program s activity although it does take some knowledge of programming at the system-call level. For example when the library routine printf is used within a program strace displays information only about the underlying write system call when it is executed. Also strace can be quite verbose many system calls are executed within a program that the programmer may not be aware of. However strace is a good way to quickly determine the cause of a program crash or other strange failure. Take the Hello World program given earlier in the chapter. Running strace on the executable hello gives us papaya strace hello execve . hello hello 49 vars 0 mmap 0 4096 PrOt_READ PRoT_WRITE MAP_PRiVaTE .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.