프로그램 사용/coLinux2010. 1. 23. 20:49
colinux가 예전에 user mode linux라고 듣기는 했지만,
그게 UML 이라고 생각을 전혀 하지 못하다니 ㄱ-

아무튼 UML을 이용해서 독립적으로 구동되게 한것이 바로 colinux 이고,
가상화의 한종류 중에 하나이기도 하다.

[링크 : http://www.hanb.co.kr/network/view.html?bi_id=1395]  UML vs KML
[링크 : http://www.hanb.co.kr/network/view.html?bi_id=267] 시스템 재해 복구 연습 해보기

[링크 : http://www.colinux.org/]
[링크 : http://user-mode-linux.sourceforge.net/]
Posted by 구차니
gcov - coverage testing tool
[링크 : http://korea.gnu.org/manual/release/gcov/gcov_1.ko.html]
[링크 : http://linux.die.net/man/1/gcov]

gcov 는 사용하지 않는 함수를 찾는데 유용한 유틸리티 이다.
이녀석을 사용하기 위해서는 컴파일시 -fprofile-arcs -ftest-coverage 두개의 옵션을 줘야 하는데
gcc 문서를 보니 아래와 같이 --coverage 하나만 주어도 무방할 것으로 보인다.(2010.01.24 추가 : --coverage만 해도 된다)
위의 옵션을 주고 컴파일을 하면, [파일명.gcno] 라는 파일이 생성되고,
파일을 실행하면 [파일명.gcda] 라는 파일이 생성된다. gcov [소스파일] 을 입력하면 분석을 한다.

-fprofile-arcs
    Add code so that program flow arcs are instrumented. During execution the program records how many times each branch and call is executed and how many times it is taken or returns. When the compiled program exits it saves this data to a file called auxname.gcda for each source file. The data may be used for profile-directed optimizations (-fbranch-probabilities), or for test coverage analysis (-ftest-coverage). Each object file's auxname is generated from the name of the output file, if explicitly specified and it is not the final executable, otherwise it is the basename of the source file. In both cases any suffix is removed (e.g. foo.gcda for input file dir/foo.c, or dir/foo.gcda for output file specified as -o dir/foo.o).

--coverage
    This option is used to compile and link code instrumented for coverage analysis. The option is a synonym for -fprofile-arcs -ftest-coverage (when compiling) and -lgcov (when linking). See the documentation for those options for more details.

-ftest-coverage
    Produce a notes file that the gcov code-coverage utility can use to show program coverage. Each source file's note file is called auxname.gcno. Refer to the -fprofile-arcs option above for a description of auxname and instructions on how to generate test coverage data. Coverage data will match the source files more closely, if you do not optimize.

[링크 : http://linux.die.net/man/1/gcc]



gprof - display call graph profile data
[링크 : http://linux.die.net/man/1/gprof]
[링크 : http://kprof.sourceforge.net/] + [링크 : http://www.graphviz.org/]

프로파일링은 어떤 함수가 몇번이나 불려지고(call), 누가 이 함수를 부르는지(call tree)
그리고 어떤 함수가 실행하는데 오래걸리는지를 분석하는 방법이다.
일반적으로 -pg 옵션을 주고 컴파일 한뒤, 한번 실행하면 프로파일링 파일이 생성된다.(정상종료 되어야 생성됨)

프로그램 실행이후에는 gmon.out 파일이 생성되고, 이 파일을 이용하여 분석한다.

-p
Generate extra code to write profile information suitable for the analysis program prof. You must use this option when compiling the source files you want data about, and you must also use it when linking.

-pg
Generate extra code to write profile information suitable for the analysis program gprof. You must use this option when compiling the source files you want data about, and you must also use it when linking.

[링크 : http://linux.die.net/man/1/gcc]



"리눅스 디버깅과 성능 튜닝 - 오픈소스 도구를 사용한 문제 원인 발견과 해결"
[링크 : http://www.yes24.com/24/goods/1948002?scode=032&srank=1]

'프로그램 사용 > gcov, gprof' 카테고리의 다른 글

gcov와 gcovr  (0) 2023.07.20
gcovr - gocv 를 html로  (0) 2023.07.10
gprof gui  (0) 2023.07.10
gcc -p -pg  (0) 2016.02.25
gprof flat view 이해하기  (0) 2010.01.24
Posted by 구차니
프로그램 사용/u-boot2010. 1. 22. 19:50
denx.de에 나온 메시지는 아래와는 좀 다른데,

GUNZIP ERROR - must RESET board to recover
에러가 발생할경우, 메모리가 부족해서 겹쳐서 제대로 압축을 해제하지 못했을 가능성이 있다고 한다.
그것도 아니라면.. 도대체 머가 문제일까?

   Verifying Checksum ... OK
   Uncompressing Kernel Image ... Error: Bad gzipped data
GUNZIP ERROR - must RESET board to recover

[링크 : http://www.denx.de/wiki/view/DULG/Manual]
    [링크 : http://www.denx.de/wiki/view/DULG/HowCanILoadAndUncompressACompressedImage]
    [링크 : http://www.denx.de/wiki/view/DULG/LinuxHangsAfterUncompressingKernel]
    [링크 : http://www.denx.de/wiki/view/DULG/LinuxUncompressingError]
Posted by 구차니
문자열은 "" 로
리스트는 []로
사전은 {}로 나타낸다.

문자열은 * 연산을 오버로딩 하고 있고 + 연산으로 여러가지 문장을 합쳐서 출력할수 있다.
(마이너스와 나누기는 안되는듯)

리스트는 배열과 비슷하게 사용이 가능하고
list[0:0] = [value] 이런식으로 리스트의 특정 위치에 값을 추가 할수 있다.
list[0:1] 하면 0번째 에서 1번째 미만의 값을 출력한다.(머 실질적으로 배열에서 0번째 값을 출력하는 셈이다)
리스트를 선언하려면
var = []
라고 선언하고 추후에 추가해주면된다.

사전도 리스트와 비슷하지만
문자열로 값을 찾아야 하고, 값과 숫자를 묶어서 입력해야 한다.
사전을 선언하려면
var = {}
라고 선언하고 추후에 추가해주면된다.

5.5. Dictionaries

Another useful data type built into Python is the dictionary (see Mapping Types — dict). Dictionaries are sometimes found in other languages as “associative memories” or “associative arrays”. Unlike sequences, which are indexed by a range of numbers, dictionaries are indexed by keys, which can be any immutable type; strings and numbers can always be keys. Tuples can be used as keys if they contain only strings, numbers, or tuples; if a tuple contains any mutable object either directly or indirectly, it cannot be used as a key. You can’t use lists as keys, since lists can be modified in place using index assignments, slice assignments, or methods like append() and extend().


[링크 : http://docs.python.org/tutorial/datastructures.html]

>>> tel = {'jack':4098, 'sape':4139}
>>> tel
{'sape': 4139, 'jack': 4098}
>>> tel['sape']
4139

>>> tel[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 0

>>> tel[4139]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 4139

>>> tel[sape]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'sape' is not defined

어떻게 보면 enum 형 같기도 하고.. associative memory 라는데 어디에 쓰는건지 모르겠다. ㅠ.ㅠ
Posted by 구차니
혹시나 해서 exit, bye(무슨 ftp인가 ㅋㅋ) 별걸 다 쳐봤는데 (quit도 아니다!)

>>> exit
Use exit() or Ctrl-D (i.e. EOF) to exit

보다시피 exit()를 입력하거나, ctrl-D를 하면 종료한다.
음.. EOF니까 windows 버전은 ctrl-z 되려나?



2010.02.26 추가
python 2.4의 경우 무조건 Ctrl-D만 적용된다.


2010.03.21 추가
>>> exit
Use exit() or Ctrl-Z plus Return to exit
Windows 용은 Ctrl-Z 이다.
Posted by 구차니
Microsoft/Windows2010. 1. 22. 11:22
앗 스샷누락.. OTL

아무튼 IE8 구동하면 창뜨자마다 웹페이지 불러오지도 못하고 죽는데
oldaut32.dll 오류가 발생을 한다.

이경우에는 IE8 기능인


원래대로를 눌러주면 원샷에 해결!
(운이 좋아서 복구 된걸지도?)


조금 다른 내용이지만, MS스러운 원인을 적어 주었다.
원인 : 원인을 알 수 없습니다.
[링크 : http://support.microsoft.com/kb/245188]
Posted by 구차니
솔찍히 이해를 못한 부분인데, 간단한 함수를 만드는 것 같다.
함수 포인터 같기도 한데 LISP에서 따왔다고도 하는데 먼소리인지 안드로메다로.

Python supports the creation of anonymous functions (i.e. functions that are not bound to a name) at runtime, using a construct called "lambda".

>>> def f (x): return x**2
... 
>>> print f(8)
64
>>> 
>>> g = lambda x: x**2
>>> 
>>> print g(8)
64

As you can see, f() and g() do exactly the same and can be used in the same ways. Note that the lambda definition does not include a "return" statement -- it always contains an expression which is returned. Also note that you can put a lambda definition anywhere a function is expected, and you don't have to assign it to a variable at all. 


[링크 : http://www.secnetix.de/olli/Python/lambda_functions.hawk]


4.7.5. Lambda Forms

By popular demand, a few features commonly found in functional programming languages like Lisp have been added to Python. With the lambda keyword, small anonymous functions can be created. Here’s a function that returns the sum of its two arguments: lambda a, b: a+b. Lambda forms can be used wherever function objects are required. They are syntactically restricted to a single expression. Semantically, they are just syntactic sugar for a normal function definition. Like nested function definitions, lambda forms can reference variables from the containing scope:

>>> def make_incrementor(n):
... return lambda x: x + n
...
>>> f = make_incrementor(42)
>>> f(0)
42
>>> f(1)
43

[링크 : http://docs.python.org/tutorial/controlflow.html]

아무튼,
>>> f
<function <lambda> at 0xb754da3c>

위의 예제 실행후 f만 입력하면 위와 같이 fuction <lambda> 라는 말이 나온다.
일종의 간단한 return이 필요없는 함수 - c에서 inline 함수? - 가 되는 것처럼 보인다.
Posted by 구차니
개소리 왈왈2010. 1. 22. 10:18
ice cream 대신
i scream 이라는 걸로 만들수 있는 상품이 있을려나? ㅋㅋ
혹시 알아? mac에서 iscream 이라고 먼가 만들지? ^^;

'개소리 왈왈' 카테고리의 다른 글

오늘도 달댕이  (12) 2010.01.28
오늘하루 - 20100125  (0) 2010.01.25
오늘도..  (0) 2010.01.22
핸드폰 위성추적 해준다고?  (5) 2010.01.20
토요일에 눈을 붙였다 눈을 떼보니..  (0) 2010.01.18
Posted by 구차니
개소리 왈왈2010. 1. 22. 00:05
오늘따라 문득 날으는 병아리 얄리가 그립고 달팽이가 그립다.







현재가 행복하지 않은 사람은 과거를 회상한다고 하지만,
문득 하드 한구석에 쳐박혀 있던 추억을 뒤적이다가
지금의 추억의 과거를 보게 되었다.


정말 사랑했구나..


그래도 난 아직 사랑을 모르겠다.
내가 너무 이기적이기 때문이겠지..

'개소리 왈왈' 카테고리의 다른 글

오늘하루 - 20100125  (0) 2010.01.25
아이스크림  (0) 2010.01.22
핸드폰 위성추적 해준다고?  (5) 2010.01.20
토요일에 눈을 붙였다 눈을 떼보니..  (0) 2010.01.18
패딩 + 스키니 + 어그부츠 = ?  (4) 2010.01.16
Posted by 구차니
파이썬은 "(쌍따옴표) 나 '(홀따옴표) 로 문자열을 변수에 저장한다.
특이하게도 """(쌍따옴표 3개) 라는 녀석이 있는데, 굳이 비유를 하자면 HTML의 <pre> 태그와 비슷한 느낌이다.

아래의 예를 보면, " 로 한녀석은 엔터치면 에러가 발생하는데 비해
>>> hello = "test
  File "<stdin>", line 1
    hello = "test
                ^
SyntaxError: EOL while scanning string literal

"""(쌍따옴표 3개)를 사용한 녀석은 아래와 같이 """ 가 나올때 까지 계속 입력을 받고, 자동으로 \n를 붙여준다.
>>> hello = """test
... asdf
... """

>>> hello
'test\nasdf\n'

>>> print hello
test
asdf

>>>

테스트 삼아 "와 '를 혼용해서 하는데 "와 "를 동시에 쓰면 문법에러가 발생한다.
이런 경우에는 \" 를 이용하여 구분을 해주어야 한다.
>>> ""test" ing"
  File "<stdin>", line 1
    ""test" ing"
         ^
SyntaxError: invalid syntax

>>> '"test" ing'
'"test" ing'

>>> "'test' ing"
"'test' ing"

Posted by 구차니